[Rcpp-commits] r3909 - in pkg/Rcpp/inst/include/Rcpp/sugar: . functions

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 7 16:07:14 CET 2012


Author: romain
Date: 2012-11-07 16:07:14 +0100 (Wed, 07 Nov 2012)
New Revision: 3909

Added:
   pkg/Rcpp/inst/include/Rcpp/sugar/sets.h
Modified:
   pkg/Rcpp/inst/include/Rcpp/sugar/functions/unique.h
   pkg/Rcpp/inst/include/Rcpp/sugar/sugar.h
Log:
some factoring out

Modified: pkg/Rcpp/inst/include/Rcpp/sugar/functions/unique.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/functions/unique.h	2012-11-07 14:40:18 UTC (rev 3908)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/unique.h	2012-11-07 15:07:14 UTC (rev 3909)
@@ -21,24 +21,9 @@
 
 #ifndef Rcpp__sugar__unique_h
 #define Rcpp__sugar__unique_h
-
-#if __cplusplus >= 201103L
-    #define RCPP_UNIQUE_SET std::unordered_set
-#elseif defined(HAS_TR1_UNORDERED_SET)
-    #define RCPP_UNIQUE_SET std::tr1::unordered_set  
-#else
-    #define RCPP_UNIQUE_SET std::set
-#endif
-              
+          
 namespace Rcpp{
 namespace sugar{
-    
-class StringCompare {
-public:
-    inline bool operator()( SEXP x, SEXP y){
-        return strcmp( char_nocheck(x), char_nocheck(y) ) < 0 ; 
-    }
-} ;
 
 template <int RTYPE, typename T>
 class Unique {

Added: pkg/Rcpp/inst/include/Rcpp/sugar/sets.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/sets.h	                        (rev 0)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/sets.h	2012-11-07 15:07:14 UTC (rev 3909)
@@ -0,0 +1,49 @@
+// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
+//
+// sets.h: Rcpp R/C++ interface class library -- 
+//
+// Copyright (C) 2012   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__sugar__sets_h
+#define Rcpp__sugar__sets_h
+
+#if __cplusplus >= 201103L
+    #define RCPP_UNIQUE_SET std::unordered_set
+    #define RCPP_UNIQUE_MAP std::unordered_map
+#elseif defined(HAS_TR1_UNORDERED_SET)
+    #define RCPP_UNIQUE_SET std::tr1::unordered_set
+    #define RCPP_UNIQUE_MAP std::tr1::unordered_map
+#else
+    #define RCPP_UNIQUE_SET std::set
+    #define RCPP_UNIQUE_MAP std::map
+#endif
+
+namespace Rcpp{
+namespace sugar{
+    
+class StringCompare {
+public:
+    inline bool operator()( SEXP x, SEXP y){
+        return strcmp( char_nocheck(x), char_nocheck(y) ) < 0 ; 
+    }
+} ;
+
+} // sugar
+} // Rcpp
+
+#endif

Modified: pkg/Rcpp/inst/include/Rcpp/sugar/sugar.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/sugar.h	2012-11-07 14:40:18 UTC (rev 3908)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/sugar.h	2012-11-07 15:07:14 UTC (rev 3909)
@@ -2,7 +2,7 @@
 //
 // sugar.h: Rcpp R/C++ interface class library -- main file for Rcpp::sugar
 //
-// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
+// Copyright (C) 2010 - 2012 Dirk Eddelbuettel and Romain Francois
 //
 // This file is part of Rcpp.
 //
@@ -22,6 +22,7 @@
 #ifndef RCPP_SUGAR_H
 #define RCPP_SUGAR_H
 
+#include <Rcpp/sugar/sets.h>
 #include <Rcpp/sugar/block/block.h>
 
 #include <Rcpp/sugar/operators/operators.h>



More information about the Rcpp-commits mailing list