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;
23 typedef std::size_t size_type;
24 typedef std::ptrdiff_t difference_type;
25 typedef typename stor_t::iterator iterator;
26 typedef typename stor_t::const_iterator const_iterator;
28 iterator begin() {
return v_.begin();}
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();}
35 bool empty()
const {
return v_.empty();}
36 void reserve(
const std::size_t n) {v_.reserve(n);}
37 void pop_back() {v_.pop_back();}
38 void clear() {v_.clear();}
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;
76 value_type
const& operator[](
const std::size_t n)
const {
return v_[n];}
77 value_type& operator[](
const std::size_t n) {
return v_[n];}
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);}
81 bool operator==(self_type
const& vs2)
const {
return v_ == vs2.v_;}
82 bool operator<(self_type
const& vs2)
const {
return v_ < vs2.v_;}
83 VDJ_PIPE_COMPARISON_OPERATOR_MEMBERS(self_type)
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
Main namespace of vdj_pipe library.
Definition: sequence_file.hpp:14