7 #ifndef VECTOR_SET_HPP_ 8 #define VECTOR_SET_HPP_ 13 namespace vdj_pipe{
namespace detail{
17 template<
class T,
class Alloc = std::allocator<T> >
19 typedef std::vector<T, Alloc>
stor_t;
29 iterator
end() {
return v_.end();}
30 const_iterator
begin()
const {
return v_.begin();}
31 const_iterator
end()
const {
return v_.end();}
32 value_type
const&
front()
const {
return v_.front();}
33 value_type
const&
back()
const {
return v_.back();}
34 std::size_t
size()
const {
return v_.size();}
40 template<
class Iter>
void insert(Iter i1, Iter i2) {
41 for( ; i1 != i2; ++i1 ) {
42 const iterator i = std::lower_bound(
v_.begin(),
v_.end(), *i1);
43 if( i ==
v_.end() || *i1 < *i ) {
49 std::pair<iterator, bool>
insert(value_type
const& t) {
50 iterator i = std::lower_bound(
v_.begin(),
v_.end(), t);
51 if( i ==
v_.end() || t < *i ) {
52 return std::make_pair(
v_.insert(i, t),
true);
54 return std::make_pair(i,
false);
57 template<
typename CompatType>
58 unsigned erase(CompatType
const& t) {
59 iterator i = std::lower_bound(
v_.begin(),
v_.end(), t);
60 if( i ==
v_.end() || t < *i )
return 0;
68 template<
typename CompatType>
69 value_type
const*
find(CompatType
const& t)
const {
70 const_iterator i = std::lower_bound(
v_.begin(),
v_.end(), t);
72 if( i ==
v_.end() || t < *i )
return 0;
78 value_type
const&
at(
const std::size_t
n)
const {
return v_.at(n);}
79 value_type&
at(
const std::size_t
n) {
return v_.at(n);}
const_iterator end() const
Definition: vector_set.hpp:31
#define VDJ_PIPE_COMPARISON_OPERATOR_MEMBERS(name)
Definition: comparison_operators_macro.hpp:10
std::size_t size() const
Definition: vector_set.hpp:34
stor_t::iterator iterator
Definition: vector_set.hpp:25
value_type const * find(CompatType const &t) const
Definition: vector_set.hpp:69
Collection of unique objects stored in an ordered vector.
Definition: vector_set.hpp:18
value_type const & at(const std::size_t n) const
Definition: vector_set.hpp:78
stor_t::const_iterator const_iterator
Definition: vector_set.hpp:26
void reserve(const std::size_t n)
Definition: vector_set.hpp:36
std::pair< iterator, bool > insert(value_type const &t)
Definition: vector_set.hpp:49
void clear()
Definition: vector_set.hpp:38
value_type const & front() const
Definition: vector_set.hpp:32
T value_type
Definition: vector_set.hpp:22
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
void insert(Iter i1, Iter i2)
Definition: vector_set.hpp:40
stor_t v_
Definition: vector_set.hpp:86
bool operator==(self_type const &vs2) const
Definition: vector_set.hpp:81
value_type & operator[](const std::size_t n)
Definition: vector_set.hpp:77
iterator end()
Definition: vector_set.hpp:29
const std::size_t n
Definition: vector_set_test.cpp:26
bool empty() const
Definition: vector_set.hpp:35
value_type const & back() const
Definition: vector_set.hpp:33
Vector_set self_type
Definition: vector_set.hpp:21
const_iterator begin() const
Definition: vector_set.hpp:30
std::vector< T, Alloc > stor_t
Definition: vector_set.hpp:19
std::ptrdiff_t difference_type
Definition: vector_set.hpp:24
iterator begin()
Definition: vector_set.hpp:28
value_type const & operator[](const std::size_t n) const
Definition: vector_set.hpp:76
std::size_t size_type
Definition: vector_set.hpp:23
value_type & at(const std::size_t n)
Definition: vector_set.hpp:79
void pop_back()
Definition: vector_set.hpp:37
unsigned erase(CompatType const &t)
Definition: vector_set.hpp:58
bool operator<(self_type const &vs2) const
Definition: vector_set.hpp:82