Skip to content

Commit d4d4e4c

Browse files
committed
adapt outer, lapply, mapply
1 parent d9e8596 commit d4d4e4c

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

inst/include/Rcpp/sugar/functions/lapply.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
//
33
// lapply.h: Rcpp R/C++ interface class library -- lapply
44
//
5-
// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2010 - 2024 Dirk Eddelbuettel and Romain Francois
6+
// Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar
67
//
78
// This file is part of Rcpp.
89
//
@@ -33,7 +34,7 @@ class Lapply : public VectorBase<
3334
> {
3435
public:
3536
typedef Rcpp::VectorBase<RTYPE,NA,T> VEC ;
36-
typedef typename ::Rcpp::traits::result_of<Function>::type result_type ;
37+
typedef typename ::Rcpp::traits::result_of<Function, T>::type result_type ;
3738

3839
Lapply( const VEC& vec_, Function fun_ ) :
3940
vec(vec_), fun(fun_){}

inst/include/Rcpp/sugar/functions/mapply/mapply_2.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
//
33
// mapply_2.h: Rcpp R/C++ interface class library -- mapply_2
44
//
5-
// Copyright (C) 2012 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2012 - 2024 Dirk Eddelbuettel and Romain Francois
6+
// Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar
67
//
78
// This file is part of Rcpp.
89
//
@@ -32,13 +33,13 @@ template <int RTYPE,
3233
>
3334
class Mapply_2 : public VectorBase<
3435
Rcpp::traits::r_sexptype_traits<
35-
typename ::Rcpp::traits::result_of<Function>::type
36+
typename ::Rcpp::traits::result_of<Function, T_1, T_2>::type
3637
>::rtype ,
3738
true ,
3839
Mapply_2<RTYPE,NA_1,T_1,NA_2,T_2,Function>
3940
> {
4041
public:
41-
typedef typename ::Rcpp::traits::result_of<Function>::type result_type ;
42+
typedef typename ::Rcpp::traits::result_of<Function, T_1, T_2>::type result_type ;
4243

4344
Mapply_2( const T_1& vec_1_, const T_2& vec_2_, Function fun_ ) :
4445
vec_1(vec_1_), vec_2(vec_2_), fun(fun_){}
@@ -62,14 +63,14 @@ template <int RTYPE,
6263
class Mapply_2_Vector_Primitive : public
6364
VectorBase<
6465
Rcpp::traits::r_sexptype_traits<
65-
typename ::Rcpp::traits::result_of<Function>::type
66+
typename ::Rcpp::traits::result_of<Function, T_1>::type
6667
>::rtype ,
6768
true ,
6869
Mapply_2_Vector_Primitive<RTYPE,NA_1,T_1,PRIM_2,Function>
6970
>
7071
{
7172
public:
72-
typedef typename ::Rcpp::traits::result_of<Function>::type result_type ;
73+
typedef typename ::Rcpp::traits::result_of<Function, T_1>::type result_type ;
7374

7475
Mapply_2_Vector_Primitive( const T_1& vec_1_, PRIM_2 prim_2_, Function fun_ ) :
7576
vec_1(vec_1_), prim_2(prim_2_), fun(fun_){}
@@ -93,14 +94,14 @@ template <int RTYPE,
9394
class Mapply_2_Primitive_Vector : public
9495
VectorBase<
9596
Rcpp::traits::r_sexptype_traits<
96-
typename ::Rcpp::traits::result_of<Function>::type
97+
typename ::Rcpp::traits::result_of<Function, T_2>::type
9798
>::rtype ,
9899
true ,
99100
Mapply_2_Primitive_Vector<RTYPE,PRIM_1,NA_2,T_2,Function>
100101
>
101102
{
102103
public:
103-
typedef typename ::Rcpp::traits::result_of<Function>::type result_type ;
104+
typedef typename ::Rcpp::traits::result_of<Function, T_2>::type result_type ;
104105

105106
Mapply_2_Primitive_Vector( PRIM_1 prim_1_, const T_2& vec_2_, Function fun_ ) :
106107
prim_1(prim_1_), vec_2(vec_2_), fun(fun_){}

inst/include/Rcpp/sugar/functions/mapply/mapply_3.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
//
33
// mapply_3.h: Rcpp R/C++ interface class library -- mapply_3
44
//
5-
// Copyright (C) 2012 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2012 - 2024 Dirk Eddelbuettel and Romain Francois
6+
// Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar
67
//
78
// This file is part of Rcpp.
89
//
@@ -33,13 +34,13 @@ template <
3334
>
3435
class Mapply_3 : public VectorBase<
3536
Rcpp::traits::r_sexptype_traits<
36-
typename ::Rcpp::traits::result_of<Function>::type
37+
typename ::Rcpp::traits::result_of<Function, T_1, T_2, T_3>::type
3738
>::rtype ,
3839
true ,
3940
Mapply_3<RTYPE_1,NA_1,T_1,RTYPE_2,NA_2,T_2,RTYPE_3,NA_3,T_3,Function>
4041
> {
4142
public:
42-
typedef typename ::Rcpp::traits::result_of<Function>::type result_type ;
43+
typedef typename ::Rcpp::traits::result_of<Function, T_1, T_2, T_3>::type result_type ;
4344

4445
typedef Rcpp::VectorBase<RTYPE_1,NA_1,T_1> VEC_1 ;
4546
typedef Rcpp::VectorBase<RTYPE_2,NA_2,T_2> VEC_2 ;

inst/include/Rcpp/sugar/matrix/outer.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
//
33
// outer.h: Rcpp R/C++ interface class library -- outer
44
//
5-
// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
5+
// Copyright (C) 2010 - 2024 Dirk Eddelbuettel and Romain Francois
6+
// Copyright (C) 2025 Dirk Eddelbuettel, Romain Francois and Iñaki Ucar
67
//
78
// This file is part of Rcpp.
89
//
@@ -31,13 +32,13 @@ template <int RTYPE,
3132
typename Function >
3233
class Outer : public MatrixBase<
3334
Rcpp::traits::r_sexptype_traits<
34-
typename ::Rcpp::traits::result_of<Function>::type
35+
typename ::Rcpp::traits::result_of<Function, LHS_T, RHS_T>::type
3536
>::rtype ,
3637
true ,
3738
Outer<RTYPE,LHS_NA,LHS_T,RHS_NA,RHS_T,Function>
3839
> {
3940
public:
40-
typedef typename ::Rcpp::traits::result_of<Function>::type result_type ;
41+
typedef typename ::Rcpp::traits::result_of<Function, LHS_T, RHS_T>::type result_type ;
4142
const static int RESULT_R_TYPE =
4243
Rcpp::traits::r_sexptype_traits<result_type>::rtype ;
4344

0 commit comments

Comments
 (0)