10#ifndef INCLUDED_O3TL_SORTED_VECTOR_HXX
11#define INCLUDED_O3TL_SORTED_VECTOR_HXX
25template<
class Value,
class Compare>
36 typename Compare = std::less<Value>,
37 template<
typename,
typename>
class Find = find_unique,
38 bool = std::is_copy_constructible<Value>::value >
44 typedef typename std::vector<Value>::iterator
iterator;
49 typedef typename std::vector<Value>::size_type
size_type;
66 std::pair<const_iterator,bool>
insert( Value&& x )
72 return std::make_pair(it,
true);
74 return std::make_pair(ret.first,
false);
77 std::pair<const_iterator,bool>
insert(
const Value& x )
83 return std::make_pair(it,
true);
85 return std::make_pair(ret.first,
false);
214 return (ret.second) ? ret.first :
m_vector.end();
244 assert( std::is_sorted(rOther.begin(), rOther.end(), Compare()));
245 assert( std::unique(rOther.begin(), rOther.end(),
compare_equal) == rOther.end());
247 m_vector.insert(
m_vector.begin(), rOther.m_vector.begin(), rOther.m_vector.end());
254 assert( std::is_sorted(rOther.begin(), rOther.end(), Compare()));
255 assert( std::unique(rOther.begin(), rOther.end(),
compare_equal) == rOther.end());
286 return !Compare()( v1, v2 ) && !Compare()( v2, v1 );
294 tmp.reserve(
m_vector.size() + rOther.size());
296 rOther.begin(), rOther.end(),
297 std::back_inserter( tmp ), Compare());
310 template<
typename,
typename>
class Find >
329 Value tmp(
const_cast<typename Value::element_type*
>(
x));
330 auto ret = super_sorted_vector::find(tmp);
340 Value tmp(
const_cast<typename Value::element_type*
>(
x));
341 auto ret = super_sorted_vector::upper_bound(tmp);
351 Value tmp(
const_cast<typename Value::element_type*
>(
x));
352 auto ret = super_sorted_vector::lower_bound(tmp);
367 return (*lhs) < (*rhs);
373 bool operator() ( std::unique_ptr<T>
const& lhs, std::unique_ptr<T>
const& rhs )
const
375 return (*lhs) < (*rhs);
382template<
class Value,
class Compare>
392 return std::make_pair(it, (it !=
last && !Compare()(
v, *it)));
399template<
class Value,
class Compare>
408 std::pair<const_iterator, const_iterator>
const its =
414 return std::make_pair(it,
true);
417 return std::make_pair(its.first,
false);
FILE * init(int, char **)
sorted_vector(sorted_vector const &)=delete
sorted_vector & operator=(sorted_vector const &)=delete
sorted_vector & operator=(sorted_vector &&)=default
super_sorted_vector::const_iterator find(typename Value::element_type const *x) const
implement find for sorted_vectors containing std::unique_ptr
super_sorted_vector::const_iterator upper_bound(typename Value::element_type const *x) const
implement upper_bound for sorted_vectors containing std::unique_ptr
sorted_vector(sorted_vector &&)=default
sorted_vector< Value, Compare, Find, true > super_sorted_vector
super_sorted_vector::const_iterator lower_bound(typename Value::element_type const *x) const
implement lower_bound for sorted_vectors containing std::unique_ptr
Represents a sorted vector of values.
std::vector< Value > vector_t
Find< Value, Compare > Find_t
sorted_vector(sorted_vector const &)=default
sorted_vector & operator=(sorted_vector const &)=default
const_reverse_iterator rend() const
static bool compare_equal(const Value &v1, const Value &v2)
void insert_sorted_unique_vector(const std::vector< Value > &rOther)
const_iterator erase(const_iterator const &position)
Value erase_extract(size_t index)
make erase return the removed element, otherwise there is no useful way of extracting a std::unique_p...
const_iterator upper_bound(const Value &x) const
void swap(sorted_vector &other)
std::vector< Value >::const_reverse_iterator const_reverse_iterator
bool operator!=(const sorted_vector &other) const
bool operator==(const sorted_vector &other) const
const Value & back() const
sorted_vector(sorted_vector &&)=default
std::vector< Value >::difference_type difference_type
const_iterator begin() const
size_type count(const Value &v) const
void reserve(size_type amount)
const_reverse_iterator rbegin() const
const Value & operator[](size_t index) const
void erase(const_iterator const &first, const_iterator const &last)
constexpr sorted_vector(std::initializer_list< Value > init)
std::vector< Value >::const_iterator const_iterator
const_iterator find(const Value &x) const
size_type erase(const Value &x)
std::vector< Value >::iterator iterator
void DeleteAndDestroyAll()
void insert_internal(const std::vector< Value > &rOther)
void erase_at(size_t index)
const_iterator end() const
void insert(sorted_vector< Value, Compare, Find > const &rOther)
void insert_sorted_unique_vector(std::vector< Value > &&rOther)
std::vector< Value >::size_type size_type
std::pair< const_iterator, bool > insert(const Value &x)
const Value & front() const
std::pair< const_iterator, bool > insert(Value &&x)
sorted_vector & operator=(sorted_vector &&)=default
const_iterator lower_bound(const Value &x) const
constexpr OUStringLiteral first
constexpr OUStringLiteral last
the elements are partially ordered by Compare, 2 elements are allowed if they are not the same elemen...
sorted_vector< Value, Compare, o3tl::find_partialorder_ptrequals >::const_iterator const_iterator
std::pair< const_iterator, bool > operator()(const_iterator first, const_iterator last, Value const &v)
the elements are totally ordered by Compare, for no 2 elements !Compare(a,b) && !Compare(b,...
std::pair< const_iterator, bool > operator()(const_iterator first, const_iterator last, Value const &v)
sorted_vector< Value, Compare, o3tl::find_unique >::const_iterator const_iterator
Implements an ordering function over a pointer, where the comparison uses the < operator on the point...
bool operator()(T *const &lhs, T *const &rhs) const
bool operator()(std::unique_ptr< T > const &lhs, std::unique_ptr< T > const &rhs) const