Add BOOST_CONTAINER_FORCEINLINE

This commit is contained in:
Ion Gaztañaga committed 2019-03-05 12:11:43 +01:00
1 parent c987400947
commit 2b3775985e
5 files changed
+324 -324

No files matched your search

+115 -115
View File
@@ -49,106 +49,106 @@ class constant_iterator
typedef constant_iterator<T, Difference> this_type;
public:
explicit constant_iterator(const T &ref, Difference range_size)
BOOST_CONTAINER_FORCEINLINE explicit constant_iterator(const T &ref, Difference range_size)
: m_ptr(&ref), m_num(range_size){}
//Constructors
constant_iterator()
BOOST_CONTAINER_FORCEINLINE constant_iterator()
: m_ptr(0), m_num(0){}
constant_iterator& operator++()
BOOST_CONTAINER_FORCEINLINE constant_iterator& operator++()
{ increment(); return *this; }
constant_iterator operator++(int)
BOOST_CONTAINER_FORCEINLINE constant_iterator operator++(int)
{
constant_iterator result (*this);
increment();
return result;
}
constant_iterator& operator--()
BOOST_CONTAINER_FORCEINLINE constant_iterator& operator--()
{ decrement(); return *this; }
constant_iterator operator--(int)
BOOST_CONTAINER_FORCEINLINE constant_iterator operator--(int)
{
constant_iterator result (*this);
decrement();
return result;
}
friend bool operator== (const constant_iterator& i, const constant_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator== (const constant_iterator& i, const constant_iterator& i2)
{ return i.equal(i2); }
friend bool operator!= (const constant_iterator& i, const constant_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const constant_iterator& i, const constant_iterator& i2)
{ return !(i == i2); }
friend bool operator< (const constant_iterator& i, const constant_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator< (const constant_iterator& i, const constant_iterator& i2)
{ return i.less(i2); }
friend bool operator> (const constant_iterator& i, const constant_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator> (const constant_iterator& i, const constant_iterator& i2)
{ return i2 < i; }
friend bool operator<= (const constant_iterator& i, const constant_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const constant_iterator& i, const constant_iterator& i2)
{ return !(i > i2); }
friend bool operator>= (const constant_iterator& i, const constant_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const constant_iterator& i, const constant_iterator& i2)
{ return !(i < i2); }
friend Difference operator- (const constant_iterator& i, const constant_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const constant_iterator& i, const constant_iterator& i2)
{ return i2.distance_to(i); }
//Arithmetic
constant_iterator& operator+=(Difference off)
BOOST_CONTAINER_FORCEINLINE constant_iterator& operator+=(Difference off)
{ this->advance(off); return *this; }
constant_iterator operator+(Difference off) const
BOOST_CONTAINER_FORCEINLINE constant_iterator operator+(Difference off) const
{
constant_iterator other(*this);
other.advance(off);
return other;
}
friend constant_iterator operator+(Difference off, const constant_iterator& right)
BOOST_CONTAINER_FORCEINLINE friend constant_iterator operator+(Difference off, const constant_iterator& right)
{ return right + off; }
constant_iterator& operator-=(Difference off)
BOOST_CONTAINER_FORCEINLINE constant_iterator& operator-=(Difference off)
{ this->advance(-off); return *this; }
constant_iterator operator-(Difference off) const
BOOST_CONTAINER_FORCEINLINE constant_iterator operator-(Difference off) const
{ return *this + (-off); }
const T& operator*() const
BOOST_CONTAINER_FORCEINLINE const T& operator*() const
{ return dereference(); }
const T& operator[] (Difference ) const
BOOST_CONTAINER_FORCEINLINE const T& operator[] (Difference ) const
{ return dereference(); }
const T* operator->() const
BOOST_CONTAINER_FORCEINLINE const T* operator->() const
{ return &(dereference()); }
private:
const T * m_ptr;
Difference m_num;
void increment()
BOOST_CONTAINER_FORCEINLINE void increment()
{ --m_num; }
void decrement()
BOOST_CONTAINER_FORCEINLINE void decrement()
{ ++m_num; }
bool equal(const this_type &other) const
BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const
{ return m_num == other.m_num; }
bool less(const this_type &other) const
BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const
{ return other.m_num < m_num; }
const T & dereference() const
BOOST_CONTAINER_FORCEINLINE const T & dereference() const
{ return *m_ptr; }
void advance(Difference n)
BOOST_CONTAINER_FORCEINLINE void advance(Difference n)
{ m_num -= n; }
Difference distance_to(const this_type &other)const
BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other)const
{ return m_num - other.m_num; }
};
@@ -160,72 +160,72 @@ class value_init_construct_iterator
typedef value_init_construct_iterator<T, Difference> this_type;
public:
explicit value_init_construct_iterator(Difference range_size)
BOOST_CONTAINER_FORCEINLINE explicit value_init_construct_iterator(Difference range_size)
: m_num(range_size){}
//Constructors
value_init_construct_iterator()
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator()
: m_num(0){}
value_init_construct_iterator& operator++()
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator++()
{ increment(); return *this; }
value_init_construct_iterator operator++(int)
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator++(int)
{
value_init_construct_iterator result (*this);
increment();
return result;
}
value_init_construct_iterator& operator--()
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator--()
{ decrement(); return *this; }
value_init_construct_iterator operator--(int)
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator--(int)
{
value_init_construct_iterator result (*this);
decrement();
return result;
}
friend bool operator== (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator== (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
{ return i.equal(i2); }
friend bool operator!= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
{ return !(i == i2); }
friend bool operator< (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator< (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
{ return i.less(i2); }
friend bool operator> (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator> (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
{ return i2 < i; }
friend bool operator<= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
{ return !(i > i2); }
friend bool operator>= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
{ return !(i < i2); }
friend Difference operator- (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
{ return i2.distance_to(i); }
//Arithmetic
value_init_construct_iterator& operator+=(Difference off)
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator+=(Difference off)
{ this->advance(off); return *this; }
value_init_construct_iterator operator+(Difference off) const
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator+(Difference off) const
{
value_init_construct_iterator other(*this);
other.advance(off);
return other;
}
friend value_init_construct_iterator operator+(Difference off, const value_init_construct_iterator& right)
BOOST_CONTAINER_FORCEINLINE friend value_init_construct_iterator operator+(Difference off, const value_init_construct_iterator& right)
{ return right + off; }
value_init_construct_iterator& operator-=(Difference off)
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator-=(Difference off)
{ this->advance(-off); return *this; }
value_init_construct_iterator operator-(Difference off) const
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator-(Difference off) const
{ return *this + (-off); }
//This pseudo-iterator's dereference operations have no sense since value is not
@@ -238,28 +238,28 @@ class value_init_construct_iterator
private:
Difference m_num;
void increment()
BOOST_CONTAINER_FORCEINLINE void increment()
{ --m_num; }
void decrement()
BOOST_CONTAINER_FORCEINLINE void decrement()
{ ++m_num; }
bool equal(const this_type &other) const
BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const
{ return m_num == other.m_num; }
bool less(const this_type &other) const
BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const
{ return other.m_num < m_num; }
const T & dereference() const
BOOST_CONTAINER_FORCEINLINE const T & dereference() const
{
static T dummy;
return dummy;
}
void advance(Difference n)
BOOST_CONTAINER_FORCEINLINE void advance(Difference n)
{ m_num -= n; }
Difference distance_to(const this_type &other)const
BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other)const
{ return m_num - other.m_num; }
};
@@ -271,72 +271,72 @@ class default_init_construct_iterator
typedef default_init_construct_iterator<T, Difference> this_type;
public:
explicit default_init_construct_iterator(Difference range_size)
BOOST_CONTAINER_FORCEINLINE explicit default_init_construct_iterator(Difference range_size)
: m_num(range_size){}
//Constructors
default_init_construct_iterator()
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator()
: m_num(0){}
default_init_construct_iterator& operator++()
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator++()
{ increment(); return *this; }
default_init_construct_iterator operator++(int)
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator++(int)
{
default_init_construct_iterator result (*this);
increment();
return result;
}
default_init_construct_iterator& operator--()
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator--()
{ decrement(); return *this; }
default_init_construct_iterator operator--(int)
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator--(int)
{
default_init_construct_iterator result (*this);
decrement();
return result;
}
friend bool operator== (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator== (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
{ return i.equal(i2); }
friend bool operator!= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
{ return !(i == i2); }
friend bool operator< (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator< (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
{ return i.less(i2); }
friend bool operator> (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator> (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
{ return i2 < i; }
friend bool operator<= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
{ return !(i > i2); }
friend bool operator>= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
{ return !(i < i2); }
friend Difference operator- (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
{ return i2.distance_to(i); }
//Arithmetic
default_init_construct_iterator& operator+=(Difference off)
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator+=(Difference off)
{ this->advance(off); return *this; }
default_init_construct_iterator operator+(Difference off) const
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator+(Difference off) const
{
default_init_construct_iterator other(*this);
other.advance(off);
return other;
}
friend default_init_construct_iterator operator+(Difference off, const default_init_construct_iterator& right)
BOOST_CONTAINER_FORCEINLINE friend default_init_construct_iterator operator+(Difference off, const default_init_construct_iterator& right)
{ return right + off; }
default_init_construct_iterator& operator-=(Difference off)
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator-=(Difference off)
{ this->advance(-off); return *this; }
default_init_construct_iterator operator-(Difference off) const
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator-(Difference off) const
{ return *this + (-off); }
//This pseudo-iterator's dereference operations have no sense since value is not
@@ -349,28 +349,28 @@ class default_init_construct_iterator
private:
Difference m_num;
void increment()
BOOST_CONTAINER_FORCEINLINE void increment()
{ --m_num; }
void decrement()
BOOST_CONTAINER_FORCEINLINE void decrement()
{ ++m_num; }
bool equal(const this_type &other) const
BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const
{ return m_num == other.m_num; }
bool less(const this_type &other) const
BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const
{ return other.m_num < m_num; }
const T & dereference() const
BOOST_CONTAINER_FORCEINLINE const T & dereference() const
{
static T dummy;
return dummy;
}
void advance(Difference n)
BOOST_CONTAINER_FORCEINLINE void advance(Difference n)
{ m_num -= n; }
Difference distance_to(const this_type &other)const
BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other) const
{ return m_num - other.m_num; }
};
@@ -382,106 +382,106 @@ class repeat_iterator
{
typedef repeat_iterator<T, Difference> this_type;
public:
explicit repeat_iterator(T &ref, Difference range_size)
BOOST_CONTAINER_FORCEINLINE explicit repeat_iterator(T &ref, Difference range_size)
: m_ptr(&ref), m_num(range_size){}
//Constructors
repeat_iterator()
BOOST_CONTAINER_FORCEINLINE repeat_iterator()
: m_ptr(0), m_num(0){}
this_type& operator++()
BOOST_CONTAINER_FORCEINLINE this_type& operator++()
{ increment(); return *this; }
this_type operator++(int)
BOOST_CONTAINER_FORCEINLINE this_type operator++(int)
{
this_type result (*this);
increment();
return result;
}
this_type& operator--()
BOOST_CONTAINER_FORCEINLINE this_type& operator--()
{ increment(); return *this; }
this_type operator--(int)
BOOST_CONTAINER_FORCEINLINE this_type operator--(int)
{
this_type result (*this);
increment();
return result;
}
friend bool operator== (const this_type& i, const this_type& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator== (const this_type& i, const this_type& i2)
{ return i.equal(i2); }
friend bool operator!= (const this_type& i, const this_type& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const this_type& i, const this_type& i2)
{ return !(i == i2); }
friend bool operator< (const this_type& i, const this_type& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator< (const this_type& i, const this_type& i2)
{ return i.less(i2); }
friend bool operator> (const this_type& i, const this_type& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator> (const this_type& i, const this_type& i2)
{ return i2 < i; }
friend bool operator<= (const this_type& i, const this_type& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const this_type& i, const this_type& i2)
{ return !(i > i2); }
friend bool operator>= (const this_type& i, const this_type& i2)
BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const this_type& i, const this_type& i2)
{ return !(i < i2); }
friend Difference operator- (const this_type& i, const this_type& i2)
BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const this_type& i, const this_type& i2)
{ return i2.distance_to(i); }
//Arithmetic
this_type& operator+=(Difference off)
BOOST_CONTAINER_FORCEINLINE this_type& operator+=(Difference off)
{ this->advance(off); return *this; }
this_type operator+(Difference off) const
BOOST_CONTAINER_FORCEINLINE this_type operator+(Difference off) const
{
this_type other(*this);
other.advance(off);
return other;
}
friend this_type operator+(Difference off, const this_type& right)
BOOST_CONTAINER_FORCEINLINE friend this_type operator+(Difference off, const this_type& right)
{ return right + off; }
this_type& operator-=(Difference off)
BOOST_CONTAINER_FORCEINLINE this_type& operator-=(Difference off)
{ this->advance(-off); return *this; }
this_type operator-(Difference off) const
BOOST_CONTAINER_FORCEINLINE this_type operator-(Difference off) const
{ return *this + (-off); }
T& operator*() const
BOOST_CONTAINER_FORCEINLINE T& operator*() const
{ return dereference(); }
T& operator[] (Difference ) const
BOOST_CONTAINER_FORCEINLINE T& operator[] (Difference ) const
{ return dereference(); }
T *operator->() const
BOOST_CONTAINER_FORCEINLINE T *operator->() const
{ return &(dereference()); }
private:
T * m_ptr;
Difference m_num;
void increment()
BOOST_CONTAINER_FORCEINLINE void increment()
{ --m_num; }
void decrement()
BOOST_CONTAINER_FORCEINLINE void decrement()
{ ++m_num; }
bool equal(const this_type &other) const
BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const
{ return m_num == other.m_num; }
bool less(const this_type &other) const
BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const
{ return other.m_num < m_num; }
T & dereference() const
BOOST_CONTAINER_FORCEINLINE T & dereference() const
{ return *m_ptr; }
void advance(Difference n)
BOOST_CONTAINER_FORCEINLINE void advance(Difference n)
{ m_num -= n; }
Difference distance_to(const this_type &other)const
BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other)const
{ return m_num - other.m_num; }
};
@@ -503,7 +503,7 @@ class emplace_iterator
BOOST_CONTAINER_FORCEINLINE this_type& operator++()
{ increment(); return *this; }
this_type operator++(int)
BOOST_CONTAINER_FORCEINLINE this_type operator++(int)
{
this_type result (*this);
increment();
@@ -513,7 +513,7 @@ class emplace_iterator
BOOST_CONTAINER_FORCEINLINE this_type& operator--()
{ decrement(); return *this; }
this_type operator--(int)
BOOST_CONTAINER_FORCEINLINE this_type operator--(int)
{
this_type result (*this);
decrement();
@@ -545,7 +545,7 @@ class emplace_iterator
BOOST_CONTAINER_FORCEINLINE this_type& operator+=(difference_type off)
{ this->advance(off); return *this; }
this_type operator+(difference_type off) const
BOOST_CONTAINER_FORCEINLINE this_type operator+(difference_type off) const
{
this_type other(*this);
other.advance(off);
@@ -571,11 +571,11 @@ class emplace_iterator
public:
template<class Allocator>
void construct_in_place(Allocator &a, T* ptr)
BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T* ptr)
{ (*m_pe)(a, ptr); }
template<class DestIt>
void assign_in_place(DestIt dest)
BOOST_CONTAINER_FORCEINLINE void assign_in_place(DestIt dest)
{ (*m_pe)(dest); }
private:
@@ -614,7 +614,7 @@ struct emplace_functor
{
typedef typename dtl::build_number_seq<sizeof...(Args)>::type index_tuple_t;
emplace_functor(BOOST_FWD_REF(Args)... args)
BOOST_CONTAINER_FORCEINLINE emplace_functor(BOOST_FWD_REF(Args)... args)
: args_(args...)
{}
@@ -661,15 +661,15 @@ struct emplace_functor_type;
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
struct emplace_functor##N\
{\
explicit emplace_functor##N( BOOST_MOVE_UREF##N )\
BOOST_CONTAINER_FORCEINLINE explicit emplace_functor##N( BOOST_MOVE_UREF##N )\
BOOST_MOVE_COLON##N BOOST_MOVE_FWD_INIT##N{}\
\
template<class Allocator, class T>\
void operator()(Allocator &a, T *ptr)\
BOOST_CONTAINER_FORCEINLINE void operator()(Allocator &a, T *ptr)\
{ allocator_traits<Allocator>::construct(a, ptr BOOST_MOVE_I##N BOOST_MOVE_MFWD##N); }\
\
template<class DestIt>\
void operator()(DestIt dest)\
BOOST_CONTAINER_FORCEINLINE void operator()(DestIt dest)\
{\
typedef typename boost::container::iterator_traits<DestIt>::value_type value_type;\
BOOST_MOVE_IF(N, value_type tmp(BOOST_MOVE_MFWD##N), dtl::value_init<value_type> tmp) ;\