diff --git a/STL_Extension/doc_tex/STL_Extension_ref/tuple.tex b/STL_Extension/doc_tex/STL_Extension_ref/tuple.tex index b64905deecf..8774bc4963a 100644 --- a/STL_Extension/doc_tex/STL_Extension_ref/tuple.tex +++ b/STL_Extension/doc_tex/STL_Extension_ref/tuple.tex @@ -10,14 +10,14 @@ %% +=========================================================================+ -\begin{ccRefClass}{tuple<...>} +\begin{ccRefClass}{cpp0x::tuple<...>} \ccDefinition An object of the class \ccClassTemplateName\ represents a heterogeneous tuple of elements of the types specified in parameters, which are in variadic number. -There is actually no class in \cgal\ with this name, but a using declaration which +There is actually no class in namespace \ccc{CGAL::cpp0x} with this name, but a using declaration which imports a class from another namespace. By order of priority: the one in namespace \ccc{std} is used (provided by C++0x), if not found, then the one in namespace \ccc{std::tr1} is used (provided by TR1), and finally, the fallback solution @@ -32,7 +32,7 @@ is taken from Boost. \ccHeading{Free functions} Some free functions part of the standard interface of \ccc{tuple} are also -brought in namespace CGAL with using declarations. These are \ccc{make_tuple}, +brought in namespace \ccc{CGAL::cpp0x} with using declarations. These are \ccc{make_tuple}, \ccc{get} and \ccc{tie}. \end{ccRefClass} diff --git a/STL_Extension/include/CGAL/iterator.h b/STL_Extension/include/CGAL/iterator.h index a964b0b0534..aa2b68315ff 100644 --- a/STL_Extension/include/CGAL/iterator.h +++ b/STL_Extension/include/CGAL/iterator.h @@ -1176,7 +1176,7 @@ filter_output_iterator(I e, const P& p) namespace CGALi { -template < typename D, typename V = tuple<>, typename O = tuple<> > +template < typename D, typename V = cpp0x::tuple<>, typename O = cpp0x::tuple<> > struct Derivator { typedef Derivator Self; @@ -1184,11 +1184,11 @@ struct Derivator }; template < typename D, typename V1, typename O1, typename... V, typename... O> -struct Derivator, tuple > - : public Derivator, tuple > +struct Derivator, cpp0x::tuple > + : public Derivator, cpp0x::tuple > { - typedef Derivator, tuple > Self; - typedef Derivator, tuple > Base; + typedef Derivator, cpp0x::tuple > Self; + typedef Derivator, cpp0x::tuple > Base; Self& operator=(const Self&) = delete; @@ -1196,7 +1196,7 @@ struct Derivator, tuple > D& operator=(const V1& v) { - * std::get< D::size - sizeof...(V) - 1 >(static_cast(static_cast(*this))) ++ = v; + * cpp0x::get< D::size - sizeof...(V) - 1 >(static_cast(static_cast(*this))) ++ = v; return static_cast(*this); } }; @@ -1210,9 +1210,9 @@ template < typename V, typename O > class Dispatch_output_iterator; template < typename... V, typename... O > -class Dispatch_output_iterator < tuple, tuple > - : private CGALi::Derivator, tuple >, tuple, tuple > - , public tuple +class Dispatch_output_iterator < cpp0x::tuple, cpp0x::tuple > + : private CGALi::Derivator, cpp0x::tuple >, cpp0x::tuple, cpp0x::tuple > + , public cpp0x::tuple { static_assert(sizeof...(V) == sizeof...(O), "The number of explicit template parameters has to match the number of arguments"); @@ -1224,8 +1224,8 @@ class Dispatch_output_iterator < tuple, tuple > public: - typedef tuple Iterators_tuple; - typedef tuple Value_types_tuple; + typedef cpp0x::tuple Iterators_tuple; + typedef cpp0x::tuple Value_types_tuple; typedef std::output_iterator_tag iterator_category; typedef void value_type; @@ -1242,7 +1242,7 @@ public: using Base::operator=; - Dispatch_output_iterator(O... o) : tuple(o...) {} + Dispatch_output_iterator(O... o) : cpp0x::tuple(o...) {} Self& operator=(const Self& s) { @@ -1258,10 +1258,10 @@ public: }; template < typename... V, typename... O> -Dispatch_output_iterator, tuple > +Dispatch_output_iterator, cpp0x::tuple > dispatch_output(O... o) { - return Dispatch_output_iterator, tuple > (o...); + return Dispatch_output_iterator, cpp0x::tuple > (o...); } @@ -1272,11 +1272,11 @@ template < typename V, typename O > class Dispatch_or_drop_output_iterator; template < typename... V, typename... O > -class Dispatch_or_drop_output_iterator < tuple, tuple > - : public Dispatch_output_iterator< tuple, tuple > +class Dispatch_or_drop_output_iterator < cpp0x::tuple, cpp0x::tuple > + : public Dispatch_output_iterator< cpp0x::tuple, cpp0x::tuple > { typedef Dispatch_or_drop_output_iterator Self; - typedef Dispatch_output_iterator< tuple, tuple > Base; + typedef Dispatch_output_iterator< cpp0x::tuple, cpp0x::tuple > Base; template friend class Derivator; @@ -1298,10 +1298,10 @@ public: template < typename... V, typename... O> inline -Dispatch_or_drop_output_iterator, tuple > +Dispatch_or_drop_output_iterator, cpp0x::tuple > dispatch_or_drop_output(O... o) { - return Dispatch_or_drop_output_iterator, tuple >(o...); + return Dispatch_or_drop_output_iterator, cpp0x::tuple >(o...); } #else @@ -1312,12 +1312,12 @@ template < typename V, typename O > class Dispatch_output_iterator; template -class Dispatch_output_iterator,tuple >:public tuple{ +class Dispatch_output_iterator,cpp0x::tuple >:public cpp0x::tuple{ typedef Dispatch_output_iterator Self; public: - typedef tuple Value_types_tuple; - typedef tuple Iterators_tuple; + typedef cpp0x::tuple Value_types_tuple; + typedef cpp0x::tuple Iterators_tuple; typedef std::output_iterator_tag iterator_category; typedef void value_type; typedef void difference_type; @@ -1332,12 +1332,12 @@ public: Dispatch_output_iterator(O1 out1,O2 out2):Iterators_tuple(out1,out2){} Self& operator=(const V1& obj){ - *get<0>(static_cast(*this))++=obj; + *cpp0x::get<0>(static_cast(*this))++=obj; return *this; } Self& operator=(const V2& obj){ - *get<1>(static_cast(*this))++=obj; + *cpp0x::get<1>(static_cast(*this))++=obj; return *this; } @@ -1354,9 +1354,9 @@ public: template inline -Dispatch_output_iterator,tuple > +Dispatch_output_iterator,cpp0x::tuple > dispatch_output(O1 out1,O2 out2){ - return Dispatch_output_iterator,tuple >(out1,out2); + return Dispatch_output_iterator,cpp0x::tuple >(out1,out2); } @@ -1366,11 +1366,11 @@ class Dispatch_or_drop_output_iterator; template -class Dispatch_or_drop_output_iterator,tuple >: - public Dispatch_output_iterator,tuple > +class Dispatch_or_drop_output_iterator,cpp0x::tuple >: + public Dispatch_output_iterator,cpp0x::tuple > { typedef Dispatch_or_drop_output_iterator Self; - typedef Dispatch_output_iterator,tuple > Base; + typedef Dispatch_output_iterator,cpp0x::tuple > Base; public: @@ -1391,9 +1391,9 @@ public: template inline -Dispatch_or_drop_output_iterator,tuple > +Dispatch_or_drop_output_iterator,cpp0x::tuple > dispatch_or_drop_output(O1 out1,O2 out2){ - return Dispatch_or_drop_output_iterator,tuple >(out1,out2); + return Dispatch_or_drop_output_iterator,cpp0x::tuple >(out1,out2); } #endif diff --git a/STL_Extension/include/CGAL/tuple.h b/STL_Extension/include/CGAL/tuple.h index 3b4566455a6..1bdd209b361 100644 --- a/STL_Extension/include/CGAL/tuple.h +++ b/STL_Extension/include/CGAL/tuple.h @@ -35,6 +35,8 @@ CGAL_BEGIN_NAMESPACE +namespace cpp0x { + #ifndef CGAL_CFG_NO_CPP0X_TUPLE using std::tuple; using std::make_tuple; @@ -52,6 +54,7 @@ using boost::tie; using boost::get; #endif +} // cpp0x #ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES @@ -60,19 +63,19 @@ template struct Is_in_tuple; template -struct Is_in_tuple > +struct Is_in_tuple > { - static const bool value = Is_in_tuple >::value; + static const bool value = Is_in_tuple >::value; }; template -struct Is_in_tuple > +struct Is_in_tuple > { static const bool value = true; }; template -struct Is_in_tuple > +struct Is_in_tuple > { static const bool value = false; }; @@ -85,25 +88,25 @@ template struct Is_in_tuple; template -struct Is_in_tuple > +struct Is_in_tuple > { - static const bool value = Is_in_tuple >::value; + static const bool value = Is_in_tuple >::value; }; template -struct Is_in_tuple > +struct Is_in_tuple > { static const bool value = true; }; template -struct Is_in_tuple > +struct Is_in_tuple > { static const bool value = true; }; template -struct Is_in_tuple > +struct Is_in_tuple > { static const bool value = false; }; diff --git a/STL_Extension/test/STL_Extension/test_dispatch_output.cpp b/STL_Extension/test/STL_Extension/test_dispatch_output.cpp index af8c1d84898..a2576a3ed86 100644 --- a/STL_Extension/test/STL_Extension/test_dispatch_output.cpp +++ b/STL_Extension/test/STL_Extension/test_dispatch_output.cpp @@ -27,12 +27,12 @@ void complete_test(std::vector data1,std::list data2){ typedef CGAL::Dispatch_output_iterator< - CGAL::tuple,CGAL::tuple< T1*,std::back_insert_iterator > > + CGAL::cpp0x::tuple,CGAL::cpp0x::tuple< T1*,std::back_insert_iterator > > > Dispatcher; typedef CGAL::Dispatch_or_drop_output_iterator< - CGAL::tuple,CGAL::tuple< T1*,std::back_insert_iterator > > + CGAL::cpp0x::tuple,CGAL::cpp0x::tuple< T1*,std::back_insert_iterator > > > Dropper; assert(data1.size()==4); @@ -72,8 +72,8 @@ void complete_test(std::vector data1,std::list data2){ T1* d; - CGAL::tie(d, bck_ins) = disp; - CGAL::tie(d, bck_ins) = drop; + CGAL::cpp0x::tie(d, bck_ins) = disp; + CGAL::cpp0x::tie(d, bck_ins) = drop; }