Skip to content

Commit 689fbe9

Browse files
committed
Merge pull request #13 from pachadotdev/3Fto1T
implement r-lib#431
1 parent 74b8210 commit 689fbe9

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

inst/include/cpp11/r_vector.hpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,18 +1435,14 @@ inline SEXP r_vector<T>::resize_names(SEXP x, R_xlen_t size) {
14351435

14361436
} // namespace writable
14371437

1438-
// TODO: is there a better condition we could use, e.g. assert something true
1439-
// rather than three things false?
1440-
template <typename C, typename T>
1441-
using is_container_but_not_sexp_or_string = typename std::enable_if<
1438+
// Ensure that C is not constructible from SEXP, and neither C nor T is a std::string
1439+
template <typename C, typename T = typename std::decay<C>::type::value_type>
1440+
typename std::enable_if<
14421441
!std::is_constructible<C, SEXP>::value &&
14431442
!std::is_same<typename std::decay<C>::type, std::string>::value &&
14441443
!std::is_same<typename std::decay<T>::type, std::string>::value,
1445-
typename std::decay<C>::type>::type;
1446-
1447-
template <typename C, typename T = typename std::decay<C>::type::value_type>
1448-
// typename T = typename C::value_type>
1449-
is_container_but_not_sexp_or_string<C, T> as_cpp(SEXP from) {
1444+
C>::type
1445+
as_cpp(SEXP from) {
14501446
auto obj = cpp11::r_vector<T>(from);
14511447
return {obj.begin(), obj.end()};
14521448
}

0 commit comments

Comments
 (0)