mirror of https://github.com/CGAL/cgal
Merge branch STL_Extension-rename-cpp0x-pmoeller into next
This commit is contained in:
commit
1bc4a806de
|
|
@ -3490,6 +3490,7 @@ STL_Extension/include/CGAL/internal/boost/mutable_heap.hpp -text
|
|||
STL_Extension/include/CGAL/internal/boost/mutable_queue.hpp -text
|
||||
STL_Extension/test/STL_Extension/test_Modifiable_priority_queue.cpp -text
|
||||
STL_Extension/test/STL_Extension/test_Uncertain.cpp -text
|
||||
STL_Extension/test/STL_Extension/test_namespaces.cpp -text
|
||||
STL_Extension/test/STL_Extension/test_type_traits.cpp -text
|
||||
Scripts/developer_scripts/autotest_cgal -text
|
||||
Scripts/developer_scripts/autotest_cgal_with_cmake -text
|
||||
|
|
|
|||
|
|
@ -154,3 +154,13 @@ list. Specifying that one wishes to use the default is simply done by omitting
|
|||
it. This is however possible only at the end of the list. \ccc{CGAL::Default}
|
||||
provides a simple mechanism that performs something equivalent anywhere in the
|
||||
sequence.
|
||||
|
||||
\section{C++ 11 wrappers}
|
||||
|
||||
#Wrappers for the classes \ccc{array} and \ccc{tuple} which, based on
|
||||
availability, either use the version of {\em Boost} or the one
|
||||
provided by the standard library are provided in the namespace
|
||||
\ccc{CGAL::cpp11}. The namespace alias \ccc{CGAL::cpp0x} is provided
|
||||
for backward compatibility. Those are documented for completeness and
|
||||
implementers. They are not intended to be used by users of the
|
||||
library.
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@
|
|||
|
||||
%% +=========================================================================+
|
||||
|
||||
\begin{ccRefClass}{cpp0x::array<T, int>}
|
||||
\begin{ccRefClass}{cpp11::array<T, int>}
|
||||
|
||||
\ccDefinition
|
||||
|
||||
An object of the class \ccClassTemplateName\ represents an array of elements
|
||||
of type \ccc{T}, the number of which is specified by the second template argument.
|
||||
|
||||
There is actually no class in namespace \ccc{CGAL::cpp0x} with this name, but a using declaration which
|
||||
There is actually no class in namespace \ccc{CGAL::cpp11} 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
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@
|
|||
|
||||
%% +=========================================================================+
|
||||
|
||||
\begin{ccRefClass}{cpp0x::tuple<...>}
|
||||
\begin{ccRefClass}{cpp11::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 namespace \ccc{CGAL::cpp0x} with this name, but a using declaration which
|
||||
There is actually no class in namespace \ccc{CGAL::cpp11} 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 and helper classes}
|
||||
|
||||
Some free functions part of the standard interface of \ccc{tuple} are also
|
||||
brought in namespace \ccc{CGAL::cpp0x} with using declarations, these are \ccc{make_tuple},
|
||||
brought in namespace \ccc{CGAL::cpp11} with using declarations, these are \ccc{make_tuple},
|
||||
\ccc{get}, \ccc{tie}. Like in C++0x, the \ccc{get} function template is
|
||||
specialized so that it can take \ccc{std::pair} as argument.
|
||||
Two standard helper classes are also provided for convenience (\ccc{tuple_size} and \ccc{tuple_element}).
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
namespace cpp0x {
|
||||
namespace cpp11 {
|
||||
#ifndef CGAL_CFG_NO_CPP0X_NEXT_PREV
|
||||
using std::next;
|
||||
using std::prev;
|
||||
|
|
@ -54,7 +54,9 @@ namespace cpp0x {
|
|||
return boost::prior(x, n);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // namespace cpp11
|
||||
|
||||
namespace cpp0x = cpp11;
|
||||
|
||||
// copy_n is usually in the STL as well, but not in the official
|
||||
// standard. We provide our own copy_n. It is planned for C++0x.
|
||||
|
|
@ -91,13 +93,16 @@ OutputIterator copy_n( InputIterator first, Size n, OutputIterator result )
|
|||
}
|
||||
#endif // CGAL_CFG_NO_CPP0X_COPY_N
|
||||
|
||||
namespace cpp0x {
|
||||
namespace cpp11 {
|
||||
#ifndef CGAL_CFG_NO_CPP0X_COPY_N
|
||||
using std::copy_n;
|
||||
#else
|
||||
using CGAL::copy_n;
|
||||
#endif
|
||||
} // cpp0x
|
||||
} // cpp11
|
||||
|
||||
namespace cpp0x = cpp11;
|
||||
|
||||
|
||||
// Not documented
|
||||
template <class T> inline
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
namespace cpp0x {
|
||||
namespace cpp11 {
|
||||
|
||||
#ifndef CGAL_CFG_NO_CPP0X_ARRAY
|
||||
using std::array;
|
||||
|
|
@ -41,12 +41,13 @@ using std::tr1::array;
|
|||
using boost::array;
|
||||
#endif
|
||||
|
||||
} // cpp0x
|
||||
} // cpp11
|
||||
|
||||
namespace cpp0x = cpp11;
|
||||
|
||||
// This using is just for short-term backward-compat, people should take the
|
||||
// habit to use CGAL::cpp0x::array.
|
||||
using cpp0x::array;
|
||||
using cpp11::array;
|
||||
|
||||
|
||||
// The make_array() function simply constructs an std::array.
|
||||
|
|
@ -80,61 +81,61 @@ using cpp0x::array;
|
|||
|
||||
template< typename T, typename... Args >
|
||||
inline
|
||||
cpp0x::array< T, 1 + sizeof...(Args) >
|
||||
cpp11::array< T, 1 + sizeof...(Args) >
|
||||
make_array(const T & t, const Args & ... args)
|
||||
{
|
||||
cpp0x::array< T, 1 + sizeof...(Args) > a = { { t, static_cast<T>(args)... } };
|
||||
cpp11::array< T, 1 + sizeof...(Args) > a = { { t, static_cast<T>(args)... } };
|
||||
return a;
|
||||
}
|
||||
|
||||
#else // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
||||
|
||||
template < typename T > inline
|
||||
cpp0x::array<T, 1>
|
||||
cpp11::array<T, 1>
|
||||
make_array(const T& b1)
|
||||
{
|
||||
cpp0x::array<T, 1> a = { { b1 } };
|
||||
cpp11::array<T, 1> a = { { b1 } };
|
||||
return a;
|
||||
}
|
||||
|
||||
template < typename T > inline
|
||||
cpp0x::array<T, 2>
|
||||
cpp11::array<T, 2>
|
||||
make_array(const T& b1, const T& b2)
|
||||
{
|
||||
cpp0x::array<T, 2> a = { { b1, b2 } };
|
||||
cpp11::array<T, 2> a = { { b1, b2 } };
|
||||
return a;
|
||||
}
|
||||
|
||||
template < typename T > inline
|
||||
cpp0x::array<T, 3>
|
||||
cpp11::array<T, 3>
|
||||
make_array(const T& b1, const T& b2, const T& b3)
|
||||
{
|
||||
cpp0x::array<T, 3> a = { { b1, b2, b3 } };
|
||||
cpp11::array<T, 3> a = { { b1, b2, b3 } };
|
||||
return a;
|
||||
}
|
||||
|
||||
template < typename T > inline
|
||||
cpp0x::array<T, 4>
|
||||
cpp11::array<T, 4>
|
||||
make_array(const T& b1, const T& b2, const T& b3, const T& b4)
|
||||
{
|
||||
cpp0x::array<T, 4> a = { { b1, b2, b3, b4 } };
|
||||
cpp11::array<T, 4> a = { { b1, b2, b3, b4 } };
|
||||
return a;
|
||||
}
|
||||
|
||||
template < typename T > inline
|
||||
cpp0x::array<T, 5>
|
||||
cpp11::array<T, 5>
|
||||
make_array(const T& b1, const T& b2, const T& b3, const T& b4, const T& b5)
|
||||
{
|
||||
cpp0x::array<T, 5> a = { { b1, b2, b3, b4, b5 } };
|
||||
cpp11::array<T, 5> a = { { b1, b2, b3, b4, b5 } };
|
||||
return a;
|
||||
}
|
||||
|
||||
template < typename T > inline
|
||||
cpp0x::array<T, 6>
|
||||
cpp11::array<T, 6>
|
||||
make_array(const T& b1, const T& b2, const T& b3, const T& b4, const T& b5,
|
||||
const T& b6)
|
||||
{
|
||||
cpp0x::array<T, 6> a = { { b1, b2, b3, b4, b5, b6 } };
|
||||
cpp11::array<T, 6> a = { { b1, b2, b3, b4, b5, b6 } };
|
||||
return a;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
namespace cpp0x {
|
||||
namespace cpp11 {
|
||||
|
||||
#ifndef CGAL_CFG_NO_CPP0X_TUPLE
|
||||
using std::tuple;
|
||||
|
|
@ -112,7 +112,9 @@ get(const std::pair<T1, T2>& pair) {
|
|||
#endif // end if not C++11 tuple
|
||||
|
||||
|
||||
} // cpp0x
|
||||
} // cpp11
|
||||
|
||||
namespace cpp0x = cpp11;
|
||||
|
||||
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
#include <CGAL/array.h>
|
||||
#include <CGAL/tuple.h>
|
||||
#include <CGAL/algorithm.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
CGAL::cpp0x::array<int, 3> arr;
|
||||
CGAL::cpp11::array<int, 3> arr2;
|
||||
|
||||
CGAL::cpp0x::tuple<double, int> tuple;
|
||||
CGAL::cpp11::tuple<double, int> tuple2;
|
||||
|
||||
CGAL::copy_n(arr.begin(), 3, arr2.begin());
|
||||
|
||||
CGAL::cpp0x::prev(arr.end());
|
||||
CGAL::cpp11::prev(arr.end());
|
||||
CGAL::cpp0x::next(arr.begin());
|
||||
CGAL::cpp11::next(arr.begin());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue