Alien-boost-mini
view release on metacpan or search on metacpan
include/boost/container/detail/flat_tree.hpp view on Meta::CPAN
return m_data.m_seq;
}
BOOST_CONTAINER_FORCEINLINE void adopt_sequence_equal(BOOST_RV_REF(container_type) seq)
{
(flat_tree_adopt_sequence_equal)( m_data.m_seq, boost::move(seq), this->priv_value_comp()
, dtl::bool_<is_contiguous_container<container_type>::value>());
}
BOOST_CONTAINER_FORCEINLINE void adopt_sequence_unique(BOOST_RV_REF(container_type) seq)
{
(flat_tree_adopt_sequence_unique)(m_data.m_seq, boost::move(seq), this->priv_value_comp()
, dtl::bool_<is_contiguous_container<container_type>::value>());
}
void adopt_sequence_equal(ordered_range_t, BOOST_RV_REF(container_type) seq)
{
BOOST_ASSERT((is_sorted)(seq.cbegin(), seq.cend(), this->priv_value_comp()));
m_data.m_seq = boost::move(seq);
}
void adopt_sequence_unique(ordered_unique_range_t, BOOST_RV_REF(container_type) seq)
{
BOOST_ASSERT((is_sorted_and_unique)(seq.cbegin(), seq.cend(), this->priv_value_comp()));
m_data.m_seq = boost::move(seq);
}
BOOST_CONTAINER_FORCEINLINE friend bool operator==(const flat_tree& x, const flat_tree& y)
{
return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin());
}
BOOST_CONTAINER_FORCEINLINE friend bool operator<(const flat_tree& x, const flat_tree& y)
{
return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
}
BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const flat_tree& x, const flat_tree& y)
{ return !(x == y); }
BOOST_CONTAINER_FORCEINLINE friend bool operator>(const flat_tree& x, const flat_tree& y)
{ return y < x; }
BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const flat_tree& x, const flat_tree& y)
{ return !(y < x); }
BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const flat_tree& x, const flat_tree& y)
{ return !(x < y); }
BOOST_CONTAINER_FORCEINLINE friend void swap(flat_tree& x, flat_tree& y)
{ x.swap(y); }
private:
template <class InputIterator>
void priv_range_insertion_construct( bool unique_insertion, InputIterator first, InputIterator last)
{
//Use cend() as hint to achieve linear time for
//ordered ranges as required by the standard
//for the constructor
//Call end() every iteration as reallocation might have invalidated iterators
if(unique_insertion){
this->insert_unique(first, last);
}
else{
this->insert_equal (first, last);
}
}
BOOST_CONTAINER_FORCEINLINE bool priv_in_range_or_end(const_iterator pos) const
{
return (this->begin() <= pos) && (pos <= this->end());
}
// insert/erase
void priv_insert_equal_prepare
(const_iterator pos, const value_type& val, insert_commit_data &data)
{
// N1780
// To insert val at pos:
// if pos == end || val <= *pos
// if pos == begin || val >= *(pos-1)
// insert val before pos
// else
// insert val before upper_bound(val)
// else
// insert val before lower_bound(val)
const value_compare &val_cmp = this->m_data;
if(pos == this->cend() || !val_cmp(*pos, val)){
if (pos == this->cbegin() || !val_cmp(val, pos[-1])){
data.position = pos;
}
else{
data.position =
this->priv_upper_bound(this->cbegin(), pos, KeyOfValue()(val));
}
}
else{
data.position =
this->priv_lower_bound(pos, this->cend(), KeyOfValue()(val));
}
}
bool priv_insert_unique_prepare
(const_iterator b, const_iterator e, const key_type& k, insert_commit_data &commit_data)
{
const key_compare &key_cmp = this->priv_key_comp();
commit_data.position = this->priv_lower_bound(b, e, k);
return commit_data.position == e || key_cmp(k, KeyOfValue()(*commit_data.position));
}
BOOST_CONTAINER_FORCEINLINE bool priv_insert_unique_prepare
(const key_type& k, insert_commit_data &commit_data)
{ return this->priv_insert_unique_prepare(this->cbegin(), this->cend(), k, commit_data); }
bool priv_insert_unique_prepare
(const_iterator pos, const key_type& k, insert_commit_data &commit_data)
{
//N1780. Props to Howard Hinnant!
//To insert k at pos:
( run in 1.116 second using v1.01-cache-2.11-cpan-140bd7fdf52 )