remove workaround c++11 features in STL_extension

This commit is contained in:
Sébastien Loriot 2019-03-19 12:25:25 +01:00
parent affaa19327
commit 3cfbccd44a
12 changed files with 3 additions and 1567 deletions

View File

@ -33,7 +33,6 @@ int format_output(const char* lib, const char* container, const char* to, int n,
struct std_tag {};
struct cgal_tag {};
#ifndef CGAL_CFG_NO_CPP0X_COPY_N
template <typename ForwardIterator, typename Size, typename OutputIterator>
inline double test(ForwardIterator it, Size n, OutputIterator result, int repeats, std_tag) {
boost::timer timer;
@ -41,7 +40,6 @@ inline double test(ForwardIterator it, Size n, OutputIterator result, int repeat
for (int i = 0; i < repeats; ++i) { std::copy_n(it, n, result); }
return (double)n*repeats/timer.elapsed()/1.0E6;
}
#endif
template <typename ForwardIterator, typename Size, typename OutputIterator>
inline double test(ForwardIterator it, Size n, OutputIterator result, int repeats, cgal_tag) {

View File

@ -51,12 +51,10 @@ int main(int argc, char* argv[]) {
format_output("CGAL", generator , n, time);
std::cout << "|- \n";
#ifndef CGAL_CFG_NO_CPP0X_COPY_N
timer.restart();
for (int i = 0; i < repeats; ++i) { std::copy_n( g, n, points.begin()); }
time = (double)n*repeats/timer.elapsed()/1.0E6;
format_output("stdlib", generator, n, time);
#endif
//wiki markup footer
std::cout << "|}" << std::endl;

View File

@ -403,7 +403,6 @@ public:
// Special insert methods that construct the objects in place
// (just forward the arguments to the constructor, to optimize a copy).
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
template < typename... Args >
iterator
emplace(const Args&... args)
@ -419,157 +418,6 @@ public:
time_stamper->set_time_stamp(ret);
return iterator(ret, 0);
}
#else
// inserts a default constructed item.
iterator emplace()
{
if (free_list == NULL)
allocate_new_block();
pointer ret = free_list;
free_list = clean_pointee(ret);
new (ret) value_type();
CGAL_assertion(type(ret) == USED);
++size_;
time_stamper->set_time_stamp(ret);
return iterator(ret, 0);
}
template < typename T1 >
iterator
emplace(const T1 &t1)
{
if (free_list == NULL)
allocate_new_block();
pointer ret = free_list;
free_list = clean_pointee(ret);
new (ret) value_type(t1);
CGAL_assertion(type(ret) == USED);
++size_;
time_stamper->set_time_stamp(ret);
return iterator(ret, 0);
}
template < typename T1, typename T2 >
iterator
emplace(const T1 &t1, const T2 &t2)
{
if (free_list == NULL)
allocate_new_block();
pointer ret = free_list;
free_list = clean_pointee(ret);
new (ret) value_type(t1, t2);
CGAL_assertion(type(ret) == USED);
++size_;
time_stamper->set_time_stamp(ret);
return iterator(ret, 0);
}
template < typename T1, typename T2, typename T3 >
iterator
emplace(const T1 &t1, const T2 &t2, const T3 &t3)
{
if (free_list == NULL)
allocate_new_block();
pointer ret = free_list;
free_list = clean_pointee(ret);
new (ret) value_type(t1, t2, t3);
CGAL_assertion(type(ret) == USED);
++size_;
time_stamper->set_time_stamp(ret);
return iterator(ret, 0);
}
template < typename T1, typename T2, typename T3, typename T4 >
iterator
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
{
if (free_list == NULL)
allocate_new_block();
pointer ret = free_list;
free_list = clean_pointee(ret);
new (ret) value_type(t1, t2, t3, t4);
CGAL_assertion(type(ret) == USED);
++size_;
time_stamper->set_time_stamp(ret);
return iterator(ret, 0);
}
template < typename T1, typename T2, typename T3, typename T4, typename T5 >
iterator
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
const T5 &t5)
{
if (free_list == NULL)
allocate_new_block();
pointer ret = free_list;
free_list = clean_pointee(ret);
new (ret) value_type(t1, t2, t3, t4, t5);
CGAL_assertion(type(ret) == USED);
++size_;
time_stamper->set_time_stamp(ret);
return iterator(ret, 0);
}
template < typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6 >
iterator
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
const T5 &t5, const T6 &t6)
{
if (free_list == NULL)
allocate_new_block();
pointer ret = free_list;
free_list = clean_pointee(ret);
new (ret) value_type(t1, t2, t3, t4, t5, t6);
CGAL_assertion(type(ret) == USED);
++size_;
time_stamper->set_time_stamp(ret);
return iterator(ret, 0);
}
template < typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7 >
iterator
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
const T5 &t5, const T6 &t6, const T7 &t7)
{
if (free_list == NULL)
allocate_new_block();
pointer ret = free_list;
free_list = clean_pointee(ret);
new (ret) value_type(t1, t2, t3, t4, t5, t6, t7);
CGAL_assertion(type(ret) == USED);
++size_;
time_stamper->set_time_stamp(ret);
return iterator(ret, 0);
}
template < typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8 >
iterator
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8)
{
if (free_list == NULL)
allocate_new_block();
pointer ret = free_list;
free_list = clean_pointee(ret);
new (ret) value_type(t1, t2, t3, t4, t5, t6, t7, t8);
CGAL_assertion(type(ret) == USED);
++size_;
time_stamper->set_time_stamp(ret);
return iterator(ret, 0);
}
#endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
iterator insert(const T &t)
{
@ -578,11 +426,7 @@ public:
pointer ret = free_list;
free_list = clean_pointee(ret);
#ifdef CGAL_CXX11
std::allocator_traits<allocator_type>::construct(alloc, ret, t);
#else
alloc.construct(ret, t);
#endif
CGAL_assertion(type(ret) == USED);
++size_;
time_stamper->set_time_stamp(ret);

View File

@ -306,7 +306,6 @@ public:
// Special insert methods that construct the objects in place
// (just forward the arguments to the constructor, to optimize a copy).
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
template < typename... Args >
iterator
emplace(const Args&... args)
@ -316,113 +315,12 @@ public:
new (ret) value_type(args...);
return finalize_insert(ret, fl);
}
#else
// inserts a default constructed item.
iterator emplace()
{
FreeList * fl = get_free_list();
pointer ret = init_insert(fl);
new (ret) value_type();
return finalize_insert(ret, fl);
}
template < typename T1 >
iterator
emplace(const T1 &t1)
{
FreeList * fl = get_free_list();
pointer ret = init_insert(fl);
new (ret) value_type(t1);
return finalize_insert(ret, fl);
}
template < typename T1, typename T2 >
iterator
emplace(const T1 &t1, const T2 &t2)
{
FreeList * fl = get_free_list();
pointer ret = init_insert(fl);
new (ret) value_type(t1, t2);
return finalize_insert(ret, fl);
}
template < typename T1, typename T2, typename T3 >
iterator
emplace(const T1 &t1, const T2 &t2, const T3 &t3)
{
FreeList * fl = get_free_list();
pointer ret = init_insert(fl);
new (ret) value_type(t1, t2, t3);
return finalize_insert(ret, fl);
}
template < typename T1, typename T2, typename T3, typename T4 >
iterator
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
{
FreeList * fl = get_free_list();
pointer ret = init_insert(fl);
new (ret) value_type(t1, t2, t3, t4);
return finalize_insert(ret, fl);
}
template < typename T1, typename T2, typename T3, typename T4, typename T5 >
iterator
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
const T5 &t5)
{
FreeList * fl = get_free_list();
pointer ret = init_insert(fl);
new (ret) value_type(t1, t2, t3, t4, t5);
return finalize_insert(ret, fl);
}
template < typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6 >
iterator
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
const T5 &t5, const T6 &t6)
{
FreeList * fl = get_free_list();
pointer ret = init_insert(fl);
new (ret) value_type(t1, t2, t3, t4, t5, t6);
return finalize_insert(ret, fl);
}
template < typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7 >
iterator
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
const T5 &t5, const T6 &t6, const T7 &t7)
{
FreeList * fl = get_free_list();
pointer ret = init_insert(fl);
new (ret) value_type(t1, t2, t3, t4, t5, t6, t7);
return finalize_insert(ret, fl);
}
template < typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8 >
iterator
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8)
{
FreeList * fl = get_free_list();
pointer ret = init_insert(fl);
new (ret) value_type(t1, t2, t3, t4, t5, t6, t7, t8);
return finalize_insert(ret, fl);
}
#endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
iterator insert(const T &t)
{
FreeList * fl = get_free_list();
pointer ret = init_insert(fl);
#ifdef CGAL_CXX11
std::allocator_traits<allocator_type>::construct(m_alloc, ret, t);
#else
m_alloc.construct(ret, t);
#endif
return finalize_insert(ret, fl);
}
@ -449,11 +347,7 @@ private:
CGAL_precondition(type(x) == USED);
EraseCounterStrategy::increment_erase_counter(*x);
#ifdef CGAL_CXX11
std::allocator_traits<allocator_type>::destroy(m_alloc, &*x);
#else
m_alloc.destroy(&*x);
#endif
/* WE DON'T DO THAT BECAUSE OF THE ERASE COUNTER
#ifndef CGAL_NO_ASSERTIONS

View File

@ -87,7 +87,6 @@ public:
ptr_ = p;
}
#ifndef CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE
Handle_for(element_type && t)
{
pointer p = allocator.allocate(1);
@ -95,7 +94,6 @@ public:
p->count = 1;
ptr_ = p;
}
#endif
/* I comment this one for now, since it's preventing the automatic conversions
to take place. We'll see if it's a problem later.
@ -109,7 +107,6 @@ public:
}
*/
#if !defined CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES && !defined CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE
template < typename T1, typename T2, typename... Args >
Handle_for(T1 && t1, T2 && t2, Args && ... args)
{
@ -118,34 +115,6 @@ public:
p->count = 1;
ptr_ = p;
}
#else
template < typename T1, typename T2 >
Handle_for(const T1& t1, const T2& t2)
{
pointer p = allocator.allocate(1);
new (&(p->t)) element_type(t1, t2);
p->count = 1;
ptr_ = p;
}
template < typename T1, typename T2, typename T3 >
Handle_for(const T1& t1, const T2& t2, const T3& t3)
{
pointer p = allocator.allocate(1);
new (&(p->t)) element_type(t1, t2, t3);
p->count = 1;
ptr_ = p;
}
template < typename T1, typename T2, typename T3, typename T4 >
Handle_for(const T1& t1, const T2& t2, const T3& t3, const T4& t4)
{
pointer p = allocator.allocate(1);
new (&(p->t)) element_type(t1, t2, t3, t4);
p->count = 1;
ptr_ = p;
}
#endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
Handle_for(const Handle_for& h)
: ptr_(h.ptr_)
@ -173,7 +142,6 @@ public:
return *this;
}
#ifndef CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE
// Note : I don't see a way to make a useful move constructor, apart
// from e.g. using NULL as a ptr value, but this is drastic.
@ -194,17 +162,12 @@ public:
return *this;
}
#endif
~Handle_for()
{
if (--(ptr_->count) == 0) {
#ifdef CGAL_CXX11
Allocator_traits::destroy(allocator, ptr_);
#else
allocator.destroy( ptr_);
#endif
allocator.deallocate( ptr_, 1);
allocator.deallocate( ptr_, 1);
}
}

View File

@ -104,14 +104,12 @@ class Handle_for_virtual
return *this;
}
#ifndef CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE
Handle_for_virtual&
operator=( Handle_for_virtual && h)
{
swap(h);
return *this;
}
#endif
// protected:
typedef RefCounted element_type;

View File

@ -68,13 +68,8 @@ class Object
Object() : obj() { }
#ifndef CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE
template <class T>
Object(T && t, private_tag) : obj(new boost::any(std::forward<T>(t))) { }
#else
template <class T>
Object(const T&t, private_tag) : obj(new boost::any(t)) { }
#endif
// implicit constructor from optionals containing variants
template<BOOST_VARIANT_ENUM_PARAMS(typename T)>
@ -155,7 +150,6 @@ class Object
};
#ifndef CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE
template <class T>
inline
Object
@ -163,15 +157,6 @@ make_object(T && t)
{
return Object(std::forward<T>(t), Object::private_tag());
}
#else
template <class T>
inline
Object
make_object(const T& t)
{
return Object(t, Object::private_tag());
}
#endif
template <class T>
inline

View File

@ -74,8 +74,6 @@ using cpp11::array;
// It's also untrue that this is not documented... It is !
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
template< typename T, typename... Args >
inline
cpp11::array< T, 1 + sizeof...(Args) >
@ -96,107 +94,6 @@ struct Construct_array
}
};
#else // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
template < typename T > inline
cpp11::array<T, 1>
make_array(const T& b1)
{
cpp11::array<T, 1> a = { { b1 } };
return a;
}
template < typename T > inline
cpp11::array<T, 2>
make_array(const T& b1, const T& b2)
{
cpp11::array<T, 2> a = { { b1, b2 } };
return a;
}
template < typename T > inline
cpp11::array<T, 3>
make_array(const T& b1, const T& b2, const T& b3)
{
cpp11::array<T, 3> a = { { b1, b2, b3 } };
return a;
}
template < typename T > inline
cpp11::array<T, 4>
make_array(const T& b1, const T& b2, const T& b3, const T& b4)
{
cpp11::array<T, 4> a = { { b1, b2, b3, b4 } };
return a;
}
template < typename T > inline
cpp11::array<T, 5>
make_array(const T& b1, const T& b2, const T& b3, const T& b4, const T& b5)
{
cpp11::array<T, 5> a = { { b1, b2, b3, b4, b5 } };
return a;
}
template < typename T > inline
cpp11::array<T, 6>
make_array(const T& b1, const T& b2, const T& b3, const T& b4, const T& b5,
const T& b6)
{
cpp11::array<T, 6> a = { { b1, b2, b3, b4, b5, b6 } };
return a;
}
// Functor version
struct Construct_array
{
template < typename T >
cpp11::array<T, 1>
operator()(const T& b1)
{
return make_array (b1);
}
template < typename T >
cpp11::array<T, 2>
operator()(const T& b1, const T& b2)
{
return make_array (b1, b2);
}
template < typename T >
cpp11::array<T, 3>
operator()(const T& b1, const T& b2, const T& b3)
{
return make_array (b1, b2, b3);
}
template < typename T >
cpp11::array<T, 4>
operator()(const T& b1, const T& b2, const T& b3, const T& b4)
{
return make_array (b1, b2, b3, b4);
}
template < typename T >
cpp11::array<T, 5>
operator()(const T& b1, const T& b2, const T& b3, const T& b4, const T& b5)
{
return make_array (b1, b2, b3, b4, b5);
}
template < typename T >
cpp11::array<T, 6>
operator()(const T& b1, const T& b2, const T& b3, const T& b4, const T& b5,
const T& b6)
{
return make_array (b1, b2, b3, b4, b5, b6);
}
};
#endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
} //namespace CGAL
#endif // CGAL_ARRAY_H

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,7 @@
#include <CGAL/config.h>
#include <utility>
#include <functional>
#include <type_traits>
#include <boost/functional/hash.hpp>
// The Triple and Quadruple classes are NOT RECOMMENDED anymore.
@ -290,33 +291,6 @@ operator<(const Quadruple<T1, T2, T3, T4>& x,
(!(y.third < x.third) && x.fourth < y.fourth)) ) ) ) );
}
#if defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE) || \
defined(CGAL_CFG_NO_CPP0X_DEFAULT_TEMPLATE_ARGUMENTS_FOR_FUNCTION_TEMPLATES) || \
BOOST_VERSION < 105000 || \
defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
template <class T, class Compare>
inline
std::pair< T, T >
make_sorted_pair(const T& t1, const T& t2, Compare comp)
{
return comp(t1, t2) ? std::make_pair(t1,t2) : std::make_pair(t2,t1);
}
template <class T>
inline
std::pair<T,T>
make_sorted_pair(const T& t1, const T& t2)
{
return make_sorted_pair(t1,t2, std::less<T>());
}
#else
} //end of namespace CGAL
#include <type_traits>
namespace CGAL {
struct Default_using_type
{
template <typename Argument, typename Value>
@ -357,7 +331,6 @@ inline P make_sorted_pair(T1&& t1, T2&& t2, Compare comp = Compare())
return comp(t1, t2) ? P(std::forward<T1>(t1), std::forward<T2>(t2))
: P(std::forward<T2>(t2), std::forward<T1>(t1));
}
#endif
} //namespace CGAL

View File

@ -40,9 +40,7 @@ struct Int_t : public CGAL::Handle_with_policy< Int_rep, Unify > {
// This is needed to prevent VC7.1 and VC8 to call
// the explicit templated constructor in Base instead of its copy-ctor.
Int_t( Int_t const& rhs ) : Base( static_cast<Base const&>(rhs) ) {}
#ifndef CGAL_CFG_NO_CPP0X_DELETED_AND_DEFAULT_FUNCTIONS
Int_t& operator=(Int_t const&)=default;
#endif
Int_t& operator=(Int_t const&)=default;
int value() const { return this->ptr()->val; }
void set_value( int i) {
this->copy_on_write();

View File

@ -184,10 +184,7 @@ struct item : public In_place_list_base<item> {
item( const item& i)
: In_place_list_base<item>(i), key(i.key) {}
#ifndef CGAL_CFG_NO_CPP0X_DELETED_AND_DEFAULT_FUNCTIONS
item& operator=(const item& rhs)=default;
#endif
bool operator== (const item& i) const { return key == i.key;}
bool operator!= (const item& i) const { return key != i.key;}
bool operator== (int i) const { return key == i;}