mirror of https://github.com/CGAL/cgal
Move tuple & co under the sub-namespace CGAL::cpp0x, to avoid name clashes
(e.g. for make_tuple() already used for Triple/Quadruple).
This commit is contained in:
parent
b11fba8345
commit
6792be2fa7
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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<D, V, O> Self;
|
||||
|
|
@ -1184,11 +1184,11 @@ struct Derivator
|
|||
};
|
||||
|
||||
template < typename D, typename V1, typename O1, typename... V, typename... O>
|
||||
struct Derivator<D, tuple<V1, V...>, tuple<O1, O...> >
|
||||
: public Derivator<D, tuple<V...>, tuple<O...> >
|
||||
struct Derivator<D, cpp0x::tuple<V1, V...>, cpp0x::tuple<O1, O...> >
|
||||
: public Derivator<D, cpp0x::tuple<V...>, cpp0x::tuple<O...> >
|
||||
{
|
||||
typedef Derivator<D, tuple<V1, V...>, tuple<O1, O...> > Self;
|
||||
typedef Derivator<D, tuple<V...>, tuple<O...> > Base;
|
||||
typedef Derivator<D, cpp0x::tuple<V1, V...>, cpp0x::tuple<O1, O...> > Self;
|
||||
typedef Derivator<D, cpp0x::tuple<V...>, cpp0x::tuple<O...> > Base;
|
||||
|
||||
Self& operator=(const Self&) = delete;
|
||||
|
||||
|
|
@ -1196,7 +1196,7 @@ struct Derivator<D, tuple<V1, V...>, tuple<O1, O...> >
|
|||
|
||||
D& operator=(const V1& v)
|
||||
{
|
||||
* std::get< D::size - sizeof...(V) - 1 >(static_cast<typename D::Iterators_tuple&>(static_cast<D&>(*this))) ++ = v;
|
||||
* cpp0x::get< D::size - sizeof...(V) - 1 >(static_cast<typename D::Iterators_tuple&>(static_cast<D&>(*this))) ++ = v;
|
||||
return static_cast<D&>(*this);
|
||||
}
|
||||
};
|
||||
|
|
@ -1210,9 +1210,9 @@ template < typename V, typename O >
|
|||
class Dispatch_output_iterator;
|
||||
|
||||
template < typename... V, typename... O >
|
||||
class Dispatch_output_iterator < tuple<V...>, tuple<O...> >
|
||||
: private CGALi::Derivator<Dispatch_output_iterator< tuple<V...>, tuple<O...> >, tuple<V...>, tuple<O...> >
|
||||
, public tuple<O...>
|
||||
class Dispatch_output_iterator < cpp0x::tuple<V...>, cpp0x::tuple<O...> >
|
||||
: private CGALi::Derivator<Dispatch_output_iterator< cpp0x::tuple<V...>, cpp0x::tuple<O...> >, cpp0x::tuple<V...>, cpp0x::tuple<O...> >
|
||||
, public cpp0x::tuple<O...>
|
||||
{
|
||||
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<V...>, tuple<O...> >
|
|||
|
||||
public:
|
||||
|
||||
typedef tuple<O...> Iterators_tuple;
|
||||
typedef tuple<V...> Value_types_tuple;
|
||||
typedef cpp0x::tuple<O...> Iterators_tuple;
|
||||
typedef cpp0x::tuple<V...> 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...>(o...) {}
|
||||
Dispatch_output_iterator(O... o) : cpp0x::tuple<O...>(o...) {}
|
||||
|
||||
Self& operator=(const Self& s)
|
||||
{
|
||||
|
|
@ -1258,10 +1258,10 @@ public:
|
|||
};
|
||||
|
||||
template < typename... V, typename... O>
|
||||
Dispatch_output_iterator<tuple<V...>, tuple<O...> >
|
||||
Dispatch_output_iterator<cpp0x::tuple<V...>, cpp0x::tuple<O...> >
|
||||
dispatch_output(O... o)
|
||||
{
|
||||
return Dispatch_output_iterator<tuple<V...>, tuple<O...> > (o...);
|
||||
return Dispatch_output_iterator<cpp0x::tuple<V...>, cpp0x::tuple<O...> > (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<V...>, tuple<O...> >
|
||||
: public Dispatch_output_iterator< tuple<V...>, tuple<O...> >
|
||||
class Dispatch_or_drop_output_iterator < cpp0x::tuple<V...>, cpp0x::tuple<O...> >
|
||||
: public Dispatch_output_iterator< cpp0x::tuple<V...>, cpp0x::tuple<O...> >
|
||||
{
|
||||
typedef Dispatch_or_drop_output_iterator Self;
|
||||
typedef Dispatch_output_iterator< tuple<V...>, tuple<O...> > Base;
|
||||
typedef Dispatch_output_iterator< cpp0x::tuple<V...>, cpp0x::tuple<O...> > Base;
|
||||
|
||||
template <typename D, typename V_, typename O_>
|
||||
friend class Derivator;
|
||||
|
|
@ -1298,10 +1298,10 @@ public:
|
|||
|
||||
template < typename... V, typename... O>
|
||||
inline
|
||||
Dispatch_or_drop_output_iterator<tuple<V...>, tuple<O...> >
|
||||
Dispatch_or_drop_output_iterator<cpp0x::tuple<V...>, cpp0x::tuple<O...> >
|
||||
dispatch_or_drop_output(O... o)
|
||||
{
|
||||
return Dispatch_or_drop_output_iterator<tuple<V...>, tuple<O...> >(o...);
|
||||
return Dispatch_or_drop_output_iterator<cpp0x::tuple<V...>, cpp0x::tuple<O...> >(o...);
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
@ -1312,12 +1312,12 @@ template < typename V, typename O >
|
|||
class Dispatch_output_iterator;
|
||||
|
||||
template<class V1,class O1,class V2,class O2>
|
||||
class Dispatch_output_iterator<tuple<V1,V2>,tuple<O1,O2> >:public tuple<O1,O2>{
|
||||
class Dispatch_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> >:public cpp0x::tuple<O1,O2>{
|
||||
typedef Dispatch_output_iterator Self;
|
||||
|
||||
public:
|
||||
typedef tuple<V1,V2> Value_types_tuple;
|
||||
typedef tuple<O1,O2> Iterators_tuple;
|
||||
typedef cpp0x::tuple<V1,V2> Value_types_tuple;
|
||||
typedef cpp0x::tuple<O1,O2> 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<Iterators_tuple& >(*this))++=obj;
|
||||
*cpp0x::get<0>(static_cast<Iterators_tuple& >(*this))++=obj;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Self& operator=(const V2& obj){
|
||||
*get<1>(static_cast<Iterators_tuple& >(*this))++=obj;
|
||||
*cpp0x::get<1>(static_cast<Iterators_tuple& >(*this))++=obj;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -1354,9 +1354,9 @@ public:
|
|||
|
||||
template<class V1,class V2,class O1,class O2>
|
||||
inline
|
||||
Dispatch_output_iterator<tuple<V1,V2>,tuple<O1,O2> >
|
||||
Dispatch_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> >
|
||||
dispatch_output(O1 out1,O2 out2){
|
||||
return Dispatch_output_iterator<tuple<V1,V2>,tuple<O1,O2> >(out1,out2);
|
||||
return Dispatch_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> >(out1,out2);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1366,11 +1366,11 @@ class Dispatch_or_drop_output_iterator;
|
|||
|
||||
|
||||
template<class V1,class O1,class V2,class O2>
|
||||
class Dispatch_or_drop_output_iterator<tuple<V1,V2>,tuple<O1,O2> >:
|
||||
public Dispatch_output_iterator<tuple<V1,V2>,tuple<O1,O2> >
|
||||
class Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> >:
|
||||
public Dispatch_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> >
|
||||
{
|
||||
typedef Dispatch_or_drop_output_iterator Self;
|
||||
typedef Dispatch_output_iterator<tuple<V1,V2>,tuple<O1,O2> > Base;
|
||||
typedef Dispatch_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> > Base;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -1391,9 +1391,9 @@ public:
|
|||
|
||||
template<class V1,class V2,class O1,class O2>
|
||||
inline
|
||||
Dispatch_or_drop_output_iterator<tuple<V1,V2>,tuple<O1,O2> >
|
||||
Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> >
|
||||
dispatch_or_drop_output(O1 out1,O2 out2){
|
||||
return Dispatch_or_drop_output_iterator<tuple<V1,V2>,tuple<O1,O2> >(out1,out2);
|
||||
return Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> >(out1,out2);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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 <typename V, typename T>
|
|||
struct Is_in_tuple;
|
||||
|
||||
template <typename V, typename T0, typename... T>
|
||||
struct Is_in_tuple <V, tuple<T0, T...> >
|
||||
struct Is_in_tuple <V, cpp0x::tuple<T0, T...> >
|
||||
{
|
||||
static const bool value = Is_in_tuple<V, tuple<T...> >::value;
|
||||
static const bool value = Is_in_tuple<V, cpp0x::tuple<T...> >::value;
|
||||
};
|
||||
|
||||
template <typename V, typename... T>
|
||||
struct Is_in_tuple <V, tuple<V, T...> >
|
||||
struct Is_in_tuple <V, cpp0x::tuple<V, T...> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
struct Is_in_tuple <V, tuple<> >
|
||||
struct Is_in_tuple <V, cpp0x::tuple<> >
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
|
@ -85,25 +88,25 @@ template <typename V, typename T>
|
|||
struct Is_in_tuple;
|
||||
|
||||
template <typename V, typename T0, typename T1>
|
||||
struct Is_in_tuple <V, tuple<T0, T1> >
|
||||
struct Is_in_tuple <V, cpp0x::tuple<T0, T1> >
|
||||
{
|
||||
static const bool value = Is_in_tuple<V, tuple<T1> >::value;
|
||||
static const bool value = Is_in_tuple<V, cpp0x::tuple<T1> >::value;
|
||||
};
|
||||
|
||||
template <typename V, typename T1>
|
||||
struct Is_in_tuple <V, tuple<V,T1> >
|
||||
struct Is_in_tuple <V, cpp0x::tuple<V,T1> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
struct Is_in_tuple <V, tuple<V> >
|
||||
struct Is_in_tuple <V, cpp0x::tuple<V> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <typename V, typename T1>
|
||||
struct Is_in_tuple <V, tuple<T1> >
|
||||
struct Is_in_tuple <V, cpp0x::tuple<T1> >
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ void complete_test(std::vector<T1> data1,std::list<T2> data2){
|
|||
|
||||
typedef
|
||||
CGAL::Dispatch_output_iterator<
|
||||
CGAL::tuple<T1,T2 >,CGAL::tuple< T1*,std::back_insert_iterator<std::vector<T2> > >
|
||||
CGAL::cpp0x::tuple<T1,T2 >,CGAL::cpp0x::tuple< T1*,std::back_insert_iterator<std::vector<T2> > >
|
||||
> Dispatcher;
|
||||
|
||||
typedef
|
||||
CGAL::Dispatch_or_drop_output_iterator<
|
||||
CGAL::tuple<T1,T2 >,CGAL::tuple< T1*,std::back_insert_iterator<std::vector<T2> > >
|
||||
CGAL::cpp0x::tuple<T1,T2 >,CGAL::cpp0x::tuple< T1*,std::back_insert_iterator<std::vector<T2> > >
|
||||
> Dropper;
|
||||
|
||||
assert(data1.size()==4);
|
||||
|
|
@ -72,8 +72,8 @@ void complete_test(std::vector<T1> data1,std::list<T2> 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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue