[Rcpp-commits] r1354 - in pkg/Rcpp/inst/include: . Rcpp/traits

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri May 28 19:57:05 CEST 2010


Author: romain
Date: 2010-05-28 19:57:05 +0200 (Fri, 28 May 2010)
New Revision: 1354

Added:
   pkg/Rcpp/inst/include/Rcpp/traits/is_const.h
   pkg/Rcpp/inst/include/Rcpp/traits/is_reference.h
   pkg/Rcpp/inst/include/Rcpp/traits/remove_const.h
   pkg/Rcpp/inst/include/Rcpp/traits/remove_const_and_reference.h
   pkg/Rcpp/inst/include/Rcpp/traits/remove_reference.h
Modified:
   pkg/Rcpp/inst/include/RcppCommon.h
Log:
need some more traits type

Added: pkg/Rcpp/inst/include/Rcpp/traits/is_const.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/is_const.h	                        (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/traits/is_const.h	2010-05-28 17:57:05 UTC (rev 1354)
@@ -0,0 +1,42 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */
+//
+// is_reference.h: Rcpp R/C++ interface class library -- identifies if a type is a reference
+//
+// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+   
+#ifndef Rcpp__traits__is_const__h
+#define Rcpp__traits__is_const__h
+
+#include <Rcpp/traits/integral_constant.h>
+
+namespace Rcpp{ namespace traits {
+	
+  /// @brief  type properties [4.5.3].
+  template<typename>
+    struct is_const
+    : public false_type { };
+
+  template<typename _Tp>
+    struct is_const<_Tp const>
+    : public true_type { };
+
+	
+}}
+
+#endif

Added: pkg/Rcpp/inst/include/Rcpp/traits/is_reference.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/is_reference.h	                        (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/traits/is_reference.h	2010-05-28 17:57:05 UTC (rev 1354)
@@ -0,0 +1,40 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */
+//
+// is_reference.h: Rcpp R/C++ interface class library -- identifies if a type is a reference
+//
+// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+   
+#ifndef Rcpp__traits__is_reference__h
+#define Rcpp__traits__is_reference__h
+
+#include <Rcpp/traits/integral_constant.h>
+
+namespace Rcpp{ namespace traits {
+	
+  template<typename>
+    struct is_reference
+    : public false_type { };
+
+  template<typename _Tp>
+    struct is_reference<_Tp&>
+    : public true_type { };
+	
+}}
+
+#endif

Added: pkg/Rcpp/inst/include/Rcpp/traits/remove_const.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/remove_const.h	                        (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/traits/remove_const.h	2010-05-28 17:57:05 UTC (rev 1354)
@@ -0,0 +1,39 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */
+//
+// is_reference.h: Rcpp R/C++ interface class library -- identifies if a type is a reference
+//
+// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+   
+#ifndef Rcpp__traits__remove_const__h
+#define Rcpp__traits__remove_const__h
+
+namespace Rcpp{ namespace traits {
+	
+  /// @brief  const-volatile modifications [4.7.1].
+  template<typename _Tp>
+    struct remove_const
+    { typedef _Tp     type; };
+
+  template<typename _Tp>
+    struct remove_const<_Tp const>
+    { typedef _Tp     type; };
+ 	
+}}
+
+#endif

Added: pkg/Rcpp/inst/include/Rcpp/traits/remove_const_and_reference.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/remove_const_and_reference.h	                        (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/traits/remove_const_and_reference.h	2010-05-28 17:57:05 UTC (rev 1354)
@@ -0,0 +1,38 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */
+//
+// is_reference.h: Rcpp R/C++ interface class library -- identifies if a type is a reference
+//
+// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+   
+#ifndef Rcpp__traits__remove_const_and_reference__h
+#define Rcpp__traits__remove_const_and_reference__h
+
+#include <Rcpp/traits/remove_const.h>
+#include <Rcpp/traits/remove_reference.h>
+
+namespace Rcpp{ namespace traits {
+	
+	template <typename T>
+	struct remove_const_and_reference {
+		typedef typename remove_reference< typename remove_const<T>::type >::type type ;
+	} ;
+	
+}}
+
+#endif

Added: pkg/Rcpp/inst/include/Rcpp/traits/remove_reference.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/remove_reference.h	                        (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/traits/remove_reference.h	2010-05-28 17:57:05 UTC (rev 1354)
@@ -0,0 +1,39 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+/* :tabSize=4:indentSize=4:noTabs=false:folding=explicit:collapseFolds=1: */
+//
+// is_reference.h: Rcpp R/C++ interface class library -- identifies if a type is a reference
+//
+// Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
+//
+// This file is part of Rcpp.
+//
+// Rcpp is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// Rcpp is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+   
+#ifndef Rcpp__traits__remove_reference__h
+#define Rcpp__traits__remove_reference__h
+
+namespace Rcpp{ namespace traits {
+	
+  /// @brief  reference modifications [4.7.2].
+  template<typename _Tp>
+    struct remove_reference
+    { typedef _Tp     type; };
+
+  template<typename _Tp>
+    struct remove_reference<_Tp&>
+    { typedef _Tp     type; };
+	
+}}
+
+#endif

Modified: pkg/Rcpp/inst/include/RcppCommon.h
===================================================================
--- pkg/Rcpp/inst/include/RcppCommon.h	2010-05-28 17:13:59 UTC (rev 1353)
+++ pkg/Rcpp/inst/include/RcppCommon.h	2010-05-28 17:57:05 UTC (rev 1354)
@@ -58,8 +58,8 @@
 		#endif
 	#endif
 	// FIXME: [romain] I did not actually check, tr1::unordered_map was 
-	// probably introduced before GCC 4.3
-	#if GCC_VERSION >= 40300
+	// probably introduced before GCC 4.2.1
+	#if GCC_VERSION >= 40201
 		#define HAS_TR1
 		#define HAS_TR1_UNORDERED_MAP
 		#define HAS_TR1_UNORDERED_SET
@@ -219,6 +219,12 @@
 #include <Rcpp/traits/r_type_traits.h>
 #include <Rcpp/traits/wrap_type_traits.h>
 
+#include <Rcpp/traits/is_const.h>
+#include <Rcpp/traits/is_reference.h>
+#include <Rcpp/traits/remove_const.h>
+#include <Rcpp/traits/remove_reference.h>
+#include <Rcpp/traits/remove_const_and_reference.h>
+
 #include <Rcpp/internal/caster.h>
 #include <Rcpp/internal/r_vector.h>
 #include <Rcpp/r_cast.h>



More information about the Rcpp-commits mailing list