Skip to content

Commit 76b0b98

Browse files
committed
enable implicit conversion from List
1 parent 44a1495 commit 76b0b98

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

inst/include/Rcpp/DataFrame.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ namespace Rcpp{
4747
set__(other) ;
4848
}
4949

50-
template <typename T>
51-
explicit DataFrame_Impl( const T& obj ) ;
50+
template <typename T,
51+
typename std::enable_if<std::is_convertible<T, SEXP>::value, int>::type = 0>
52+
DataFrame_Impl( const T& obj ) ;
5253

5354
DataFrame_Impl& operator=( DataFrame_Impl& other){
5455
if (*this != other) set__(other);

inst/include/Rcpp/api/meat/DataFrame.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Copyright (C) 2013 Romain Francois
1+
// Copyright (C) 2013 - 2025 Romain Francois
2+
// Copyright (C) 2026 Romain Francois and Iñaki Ucar
23
//
34
// This file is part of Rcpp.
45
//
@@ -21,7 +22,8 @@
2122
namespace Rcpp{
2223

2324
template <template <class> class StoragePolicy>
24-
template <class T>
25+
template <class T,
26+
typename std::enable_if<std::is_convertible<T, SEXP>::value, int>::type>
2527
DataFrame_Impl<StoragePolicy>::DataFrame_Impl( const T& obj){
2628
set__(Shield<SEXP>(wrap(obj)));
2729
}

0 commit comments

Comments
 (0)