Vcsn  2.1
Be Rational
wet.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cassert>
4 #include <map>
5 #include <set>
6 #include <type_traits>
7 #include <unordered_map>
8 
9 #include <boost/iterator/iterator_facade.hpp>
10 
11 #include <vcsn/ctx/traits.hh> // labelset_t_of
13 #include <vcsn/misc/empty.hh>
14 #include <vcsn/misc/functional.hh> // vcsn::equal_to
15 #include <vcsn/misc/type_traits.hh>
16 
17 namespace vcsn
18 {
19  namespace detail
20  {
21 
22  /*------------------.
23  | welement_label. |
24  `------------------*/
25 
26  template <typename Label>
28  {
29  using label_t = Label;
31  : label_(l)
32  {}
33 
34  const label_t& label() const { return label_; }
35  void label(const label_t& l) { label_ = l; }
36 
37  private:
39  };
40 
41  template <>
43  {
44  using label_t = empty_t;
46  {}
47  label_t label() const { return {}; }
48  void label(label_t) {}
49  };
50 
51 
52  /*-------------------.
53  | welement_weight. |
54  `-------------------*/
55 
56  template <typename Weight>
58  {
59  using weight_t = Weight;
61  : weight_(w)
62  {}
63  const weight_t& weight() const { return weight_; }
64  void weight(const weight_t& k) { weight_ = k; }
65 
66  private:
68  };
69 
70  template <>
71  struct welement_weight<bool>
72  {
73  using weight_t = bool;
75  {
76  (void) w; assert(w);
77  }
78  weight_t weight() const { return true; }
79  void weight(const weight_t& w) { (void) w; assert(w); }
80  };
81  }
82 
83  /*------------.
84  | welement. |
85  `------------*/
86 
87  template <typename Label, typename Weight>
88  struct welement
89  : detail::welement_label<Label>
90  , detail::welement_weight<Weight>
91  {
94 
97 
100 
101  welement(const label_t& l, const weight_t& w)
102  : welement_label_t(l)
103  , welement_weight_t(w)
104  {}
105 
106  operator value_t() const
107  {
108  return {this->label(), this->weight()};
109  }
110 
111  auto operator<(const welement& that) const
112  -> bool
113  {
114  return this->label() < that.label();
115  }
116 
117  auto operator==(const welement& that) const
118  -> bool
119  {
120  return this->label() == that.label();
121  }
122  };
123 
124  template <typename Label, typename Weight>
126  -> decltype(m.label())
127  {
128  return m.label();
129  }
130 
131  template <typename Label, typename Weight>
133  -> decltype(m.weight())
134  {
135  return m.weight();
136  }
137 
138  template <typename Label, typename Weight>
139  void weight_set(welement<Label, Weight>& m, const Weight& w)
140  {
141  m.weight(w);
142  }
143 
144  template <typename Label, typename Weight>
145  const Label& label_of(const std::pair<Label, Weight>& m)
146  {
147  return m.first;
148  }
149 
150  template <typename Label, typename Weight>
151  const Weight& weight_of(const std::pair<Label, Weight>& m)
152  {
153  return m.second;
154  }
155 
156  template <typename Label, typename Weight>
157  Label& label_of(std::pair<Label, Weight>& m)
158  {
159  return m.first;
160  }
161 
162  template <typename Label, typename Weight>
163  void weight_set(std::pair<Label, Weight>& m, const Weight& w)
164  {
165  m.second = w;
166  }
167 
168  enum class wet_kind_t
169  {
170  bitset,
171  map,
172  set,
174  };
175 
176 
177  namespace detail
178  {
179 
180  /*-----------------------.
181  | wet_map<Key, Value>. |
182  `-----------------------*/
183 
185  template <typename Key, typename Value,
186  typename Compare>
187  class wet_map
188  {
189  private:
190  using map_t = std::map<Key, Value, Compare>;
192 
193  public:
194  using self_t = wet_map;
195  static constexpr wet_kind_t kind = wet_kind_t::map;
196  using key_t = Key;
197  using value_t = Value;
199  using mapped_type = typename map_t::mapped_type;
200  using value_type = typename map_t::value_type;
201  using iterator = typename map_t::iterator;
202  using const_iterator = typename map_t::const_iterator;
203 
204  wet_map() = default;
205 
206  wet_map(const std::initializer_list<value_type>& l)
207  : map_{l}
208  {}
209 
210  static const key_t& key_of(const value_type& p)
211  {
212  return p.first;
213  }
214 
215  static const value_t& value_of(const value_type& p)
216  {
217  return p.second;
218  }
219 
220  void set(const key_t& k, const value_t& v)
221  {
222  map_[k] = v;
223  }
224 
225  void set(const iterator& i, const value_t& v)
226  {
227  i->second = v;
228  }
229 
230  template <typename Fun>
231  void for_each(Fun f) const
232  {
233  std::for_each(begin(map_), end(map_),
234  f);
235  }
236 
237 #define DEFINE(Name, Const) \
238  template <typename... Args> \
239  auto \
240  Name(Args&&... args) Const \
241  -> decltype(map_.Name(std::forward<Args>(args)...)) \
242  { \
243  return map_.Name(std::forward<Args>(args)...); \
244  }
245 
246  DEFINE(key_comp, const);
249  DEFINE(begin,const);
250  DEFINE(find,const);
253  DEFINE(end, const);
256  DEFINE(empty,const);
257  DEFINE(size, const);
258 #undef DEFINE
259  };
260 
261 
262  /*---------------------------------.
263  | wet_unordered_map<Key, Value>. |
264  `---------------------------------*/
265 
267  template <typename Key, typename Value,
268  typename Hash, typename KeyEqual>
270  {
271  private:
272  using map_t = std::unordered_map<Key, Value, Hash, KeyEqual>;
274 
275  public:
278  using key_t = Key;
279  using value_t = Value;
281  using value_type = typename map_t::value_type;
282  using iterator = typename map_t::iterator;
283  using const_iterator = typename map_t::const_iterator;
284 
285  wet_unordered_map() = default;
286 
287  wet_unordered_map(const std::initializer_list<value_type>& l)
288  : map_{l}
289  {}
290 
291  static const key_t& key_of(const value_type& p)
292  {
293  return p.first;
294  }
295 
296  static const value_t& value_of(const value_type& p)
297  {
298  return p.second;
299  }
300 
301  void set(const key_t& k, const value_t& v)
302  {
303  map_[k] = v;
304  }
305 
306  void set(const iterator& i, const value_t& v)
307  {
308  i->second = v;
309  }
310 
311  template <typename Fun>
312  void for_each(Fun f) const
313  {
314  std::for_each(begin(map_), end(map_),
315  f);
316  }
317 
318 #define DEFINE(Name, Const) \
319  template <typename... Args> \
320  auto \
321  Name(Args&&... args) Const \
322  -> decltype(map_.Name(std::forward<Args>(args)...)) \
323  { \
324  return map_.Name(std::forward<Args>(args)...); \
325  }
326 
329  DEFINE(begin,const);
330  DEFINE(find,const);
333  DEFINE(end, const);
336  DEFINE(empty,const);
337  DEFINE(size, const);
338 #undef DEFINE
339  };
340 
341 
342  /*----------------------.
343  | wet_set<Key, bool>. |
344  `----------------------*/
345 
346 
347  template <typename Key, typename Compare>
348  class wet_set
349  {
350  private:
351  using set_t = std::set<Key, Compare>;
353 
354  public:
355  using self_t = wet_set;
356  static constexpr wet_kind_t kind = wet_kind_t::set;
357  using key_t = Key;
358  using value_t = bool;
361 
362  wet_set() = default;
363  wet_set(const std::initializer_list<value_type>& p)
364  {
365  for (const auto& m: p)
366  set(label_of(m), weight_of(m));
367  }
368 
370  template <typename Value, typename Iterator>
372  : public boost::iterator_facade<iterator_impl<Value, Iterator>
373  , Value
374  , boost::forward_traversal_tag
375  >
376  {
378  using iterator_t = Iterator;
379  using value_t = Value;
381 
382  template <typename OtherValue, typename OtherIterator>
384  : it_(that.iterator())
385  {}
386 
388  : it_(it)
389  {}
390 
391  const iterator_t& iterator() const
392  {
393  return it_;
394  }
395 
397  {
398  return {*it_, true};
399  }
400 
401  private:
403 
405  void increment()
406  {
407  ++it_;
408  }
409 
410  void decrement()
411  {
412  --it_;
413  }
414 
415  void advance(int n)
416  {
417  it_ += n;
418  }
419 
420  template <typename OtherValue, typename OtherIterator>
422  {
423  return iterator() == that.iterator();
424  }
425 
427  };
428 
431 
433  using const_iterator
435 
436  auto begin() -> iterator { return {set_.begin()}; }
437  auto end() -> iterator { return {set_.end()}; }
438  auto cbegin() const -> const_iterator { return {set_.cbegin()}; }
439  auto cend() const -> const_iterator { return {set_.cend()}; }
440  auto begin() const -> const_iterator { return cbegin(); }
441  auto end() const -> const_iterator { return cend(); }
442 
443  void set(const key_t& k, const value_t& v)
444  {
445  assert(v); (void) v;
446  set_.emplace(k);
447  }
448 
449  // When called, the key is already defined.
450  void set(const iterator&, const value_t& v)
451  {
452  assert(v); (void) v;
453  }
454 
456  -> iterator
457  {
458  return set_.erase(pos.iterator());
459  }
460 
461  template <typename... Args>
462  auto find(Args&&... args) const
463  -> const_iterator
464  {
465  return set_.find(std::forward<Args>(args)...);
466  }
467 
468  template <typename... Args>
469  auto find(Args&&... args)
470  -> iterator
471  {
472  return set_.find(std::forward<Args>(args)...);
473  }
474 
475 
476 #define DEFINE(Name, Const) \
477  template <typename... Args> \
478  auto \
479  Name(Args&&... args) Const \
480  -> decltype(set_.Name(std::forward<Args>(args)...)) \
481  { \
482  return set_.Name(std::forward<Args>(args)...); \
483  }
484 
487  DEFINE(empty,const);
488  DEFINE(size, const);
489 #undef DEFINE
490  };
491 
492 
493  /*---------------------------------------.
494  | wet_bitset<unsigned, bool>: bitsets. |
495  `---------------------------------------*/
496 
498  {
499  private:
500  using set_t = boost::dynamic_bitset<>;
502 
503  public:
505  static constexpr wet_kind_t kind = wet_kind_t::bitset;
506  using key_t = unsigned;
507  using value_t = bool;
510 
511  // A plain "wet_bitset() = default;" fails with GCC 4.8 or 4.9.0:
512  // error: converting to 'const boost::dynamic_bitset<>'
513  // from initializer list would use explicit constructor
514  // 'boost::dynamic_bitset<Block, Allocator>::dynamic_bitset([...])
515  //
516  // wet_bitset() = default;
517  // ^
519 
520  wet_bitset(size_t size)
521  : set_{size}
522  {}
523 
524  wet_bitset(const std::initializer_list<value_type>& p)
525  {
526  for (const auto& m: p)
527  set(label_of(m), weight_of(m));
528  }
529 
531  : set_{std::move(set)}
532  {}
533 
534  const set_t& set() const
535  {
536  return set_;
537  }
538 
541  {
542  return set_;
543  }
544 
545  void clear()
546  {
547  set_.reset();
548  }
549 
550  bool empty() const
551  {
552  return set_.none();
553  }
554 
555  size_t size() const
556  {
557  return set_.count();
558  }
559 
560  static constexpr size_t npos = set_t::npos;
561 
563  template <typename Value, typename Set>
565  : public boost::iterator_facade<iterator_impl<Value, Set>
566  , Value
567  , boost::forward_traversal_tag
568  >
569  {
571  using set_t = Set;
572  using iterator_t = size_t;
573  using value_t = Value;
575 
576  template <typename OtherValue, typename OtherSet>
578  : set_(that.set())
579  , it_(that.iterator())
580  {}
581 
582  iterator_impl(set_t& set, size_t pos)
583  : set_(set)
584  , it_(pos)
585  {}
586 
588  : set_(set)
589  , it_(set.find_first())
590  {}
591 
593  {
594  assert(&set_ == &that.set_);
595  it_ = that.it_;
596  return *this;
597  }
598 
599  const set_t& set() const
600  {
601  return set_;
602  }
603 
604  const iterator_t& iterator() const
605  {
606  return it_;
607  }
608 
610  {
611  return {key_t(it_), true};
612  }
613 
614  private:
616 
618  void increment()
619  {
620  it_ = set_.find_next(it_);
621  }
622 
623  template <typename OtherValue, typename OtherSet>
625  {
626  return (iterator() == that.iterator()
627  && set() == that.set());
628  }
629 
633  };
634 
637 
640 
641  auto begin() -> iterator { return {set_}; }
642  auto end() -> iterator { return {set_, npos}; }
643 
644  auto cbegin() const -> const_iterator { return {set_}; }
645  auto cend() const -> const_iterator { return {set_, npos}; }
646 
647  auto begin() const -> const_iterator { return cbegin(); }
648  auto end() const -> const_iterator { return cend(); }
649 
651  static key_t key(char k)
652  {
653  return static_cast<unsigned char>(k);
654  }
655 
656  void set(const key_t k, value_t v = true)
657  {
658  assert(v); (void) v;
659  set_.set(k);
660  }
661 
662  void set(const char k, value_t v = true)
663  {
664  set(key(k), v);
665  }
666 
667  // When called, the key is already defined.
668  void set(const iterator&, const value_t v = true)
669  {
670  assert(v); (void) v;
671  }
672 
674  -> void
675  {
676  set_.reset(pos.iterator());
677  }
678 
679  void erase(key_t k)
680  {
681  set_.reset(k);
682  }
683 
684  void erase(char k)
685  {
686  erase(key(k));
687  }
688 
689  auto find(key_t k) const
690  -> const_iterator
691  {
692  if (set_[k])
693  return {set_, k};
694  else
695  return end();
696  }
697 
698  auto find(key_t k)
699  -> iterator
700  {
701  if (set_[k])
702  return {set_, k};
703  else
704  return end();
705  }
706 
707  auto find(char k) const
708  -> const_iterator
709  {
710  return find(key(k));
711  }
712 
713  auto find(char k)
714  -> iterator
715  {
716  return find(key(k));
717  }
718  };
719 
720 
721  /*------------------------.
722  | wet_kind<Key, Value>. |
723  `------------------------*/
724 
725  // wet_impl<Key, Value>: map.
726  template <typename Key, typename Value>
728  {
729  static constexpr wet_kind_t kind = wet_kind_t::map;
730  };
731 
732  // wet_impl<Key, bool>: set.
733  template <typename Key>
734  struct wet_kind_impl<Key, bool>
735  {
736  static constexpr wet_kind_t kind = wet_kind_t::set;
737  };
738 
739  // wet_impl<char, bool>: bitsets.
740  template <>
741  struct wet_kind_impl<char, bool>
742  {
743  static constexpr wet_kind_t kind = wet_kind_t::bitset;
744  };
745 
746  template <typename Key, typename Value>
747  constexpr wet_kind_t wet_kind()
748  {
750  }
751 
752 
753  /*------------------------.
754  | wet_impl<Key, Value>. |
755  `------------------------*/
756 
757  // wet_impl<Key, Value>: map.
758  template <wet_kind_t Kind,
759  typename Key, typename Value,
760  typename Compare, typename Hash, typename KeyEqual>
761  using wet_impl
763  wet_bitset,
765  wet_set<Key, Compare>,
767  wet_map<Key, Value, Compare>,
769  wet_unordered_map<Key, Value, Hash, KeyEqual>,
770  void> > > >;
771 
772  }
773 
774  template <typename Key, typename Value,
775  wet_kind_t Kind = detail::wet_kind<Key, Value>(),
776  typename Compare = std::less<Key>,
777  typename Hash = std::hash<Key>,
778  typename KeyEqual = std::equal_to<Key>>
779  using wet = detail::wet_impl<Kind,
780  Key, Value, Compare, Hash, KeyEqual>;
781 
783  template <typename Context,
784  wet_kind_t Kind = detail::wet_kind<labelset_t_of<Context>,
788  Kind,
792 }
void set(const iterator &i, const value_t &v)
Definition: wet.hh:225
static constexpr wet_kind_t kind
Definition: wet.hh:729
auto find(Args &&...args) const -> const_iterator
Definition: wet.hh:462
welement< key_t, value_t > welement_t
Definition: wet.hh:508
typename map_t::const_iterator const_iterator
Definition: wet.hh:202
auto find(Args &&...args) -> iterator
Definition: wet.hh:469
wet_bitset(set_t &&set)
Definition: wet.hh:530
const weight_t & weight() const
Definition: wet.hh:63
auto size(Args &&...args) const -> decltype(map_.size(std::forward< Args >(args)...))
Definition: wet.hh:257
This is useful to make hashes with labels or weights as keys without using non-default constructors; ...
Definition: functional.hh:12
welement< typename std::remove_reference< label_t >::type, typename std::remove_reference< weight_t >::type > value_t
Definition: wet.hh:99
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
Definition: traits.hh:46
auto size(Args &&...args) const -> decltype(set_.size(std::forward< Args >(args)...))
Definition: wet.hh:488
auto empty(Args &&...args) const -> decltype(map_.empty(std::forward< Args >(args)...))
Definition: wet.hh:336
const iterator_t & iterator() const
Definition: wet.hh:391
typename map_t::value_type value_type
Definition: wet.hh:200
auto erase(Args &&...args) -> decltype(map_.erase(std::forward< Args >(args)...))
Definition: wet.hh:252
auto find(Args &&...args) const -> decltype(map_.find(std::forward< Args >(args)...))
Definition: wet.hh:330
iterator_impl(const iterator_impl< OtherValue, OtherIterator > &that)
Definition: wet.hh:383
size_t size() const
Definition: wet.hh:555
Set set_t
Underlying "iterator".
Definition: wet.hh:571
Functor to compare Values of ValueSets.
Definition: functional.hh:72
auto label_of(const welement< Label, Weight > &m) -> decltype(m.label())
Definition: wet.hh:125
auto cbegin() const -> const_iterator
Definition: wet.hh:438
static const key_t & key_of(const value_type &p)
Definition: wet.hh:291
auto cend() const -> const_iterator
Definition: wet.hh:645
auto erase(const_iterator pos) -> void
Definition: wet.hh:673
void for_each(Fun f) const
Definition: wet.hh:231
std::string type(const automaton &a)
The implementation type of a.
Definition: others.cc:197
typename map_t::iterator iterator
Definition: wet.hh:201
Iterator iterator_t
Underlying iterator.
Definition: wet.hh:378
static const value_t & value_of(const value_type &p)
Definition: wet.hh:215
auto end() -> iterator
Definition: wet.hh:437
static constexpr wet_kind_t kind
Definition: wet.hh:195
bool empty() const
Definition: wet.hh:550
detail::wet_impl< Kind, Key, Value, Compare, Hash, KeyEqual > wet
Definition: wet.hh:780
friend class boost::iterator_core_access
Definition: wet.hh:615
set_t & set()
FIXME: Avoid this by exposing more interfaces.
Definition: wet.hh:540
Empty labels, for LAO.
Definition: empty.hh:8
iterator_impl & operator=(const iterator_impl &that)
Definition: wet.hh:592
auto begin(Args &&...args) const -> decltype(map_.begin(std::forward< Args >(args)...))
Definition: wet.hh:249
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
Definition: traits.hh:51
bool equal(const iterator_impl< OtherValue, OtherIterator > &that) const
Definition: wet.hh:421
auto operator<(const welement &that) const -> bool
Definition: wet.hh:111
welement_weight(const weight_t &w)
Definition: wet.hh:60
#define DEFINE(Name, Const)
Definition: wet.hh:476
auto find(key_t k) -> iterator
Definition: wet.hh:698
typename map_t::const_iterator const_iterator
Definition: wet.hh:283
iterator_impl(const iterator_t &it)
Definition: wet.hh:387
auto key_comp(Args &&...args) const -> decltype(map_.key_comp(std::forward< Args >(args)...))
Definition: wet.hh:246
wet_kind_t
Definition: wet.hh:168
void set(const iterator &i, const value_t &v)
Definition: wet.hh:306
void set(const key_t &k, const value_t &v)
Definition: wet.hh:220
const set_t & set() const
Definition: wet.hh:534
const set_t & set() const
Definition: wet.hh:599
wet_map(const std::initializer_list< value_type > &l)
Definition: wet.hh:206
welement< key_t, value_t > welement_t
Definition: wet.hh:359
auto begin() -> iterator
Definition: wet.hh:436
welement_label(const label_t &l)
Definition: wet.hh:30
welement_weight(const weight_t &w)
Definition: wet.hh:74
This is useful to make hashes with labels or weights as keys without using non-default constructors; ...
Definition: functional.hh:42
std::set< Key, Compare > set_t
Definition: wet.hh:351
welement_t operator*() const
Definition: wet.hh:396
bool equal(const iterator_impl< OtherValue, OtherSet > &that) const
Definition: wet.hh:624
welement_label(const label_t &)
Definition: wet.hh:45
static const value_t & value_of(const value_type &p)
Definition: wet.hh:296
std::unordered_map< Key, Value, Hash, KeyEqual > map_t
Definition: wet.hh:272
set_t & set_
Underlying bitset.
Definition: wet.hh:631
General case.
Definition: wet.hh:187
std::map< Key, Value, Compare > map_t
Definition: wet.hh:190
auto emplace(Args &&...args) -> decltype(map_.emplace(std::forward< Args >(args)...))
Definition: wet.hh:247
void increment()
Advance to next position.
Definition: wet.hh:618
auto operator==(const welement &that) const -> bool
Definition: wet.hh:117
void set(const iterator &, const value_t &v)
Definition: wet.hh:450
void set(const key_t k, value_t v=true)
Definition: wet.hh:656
conditional_t< Kind==wet_kind_t::bitset, wet_bitset, conditional_t< Kind==wet_kind_t::set, wet_set< Key, Compare >, conditional_t< Kind==wet_kind_t::map, wet_map< Key, Value, Compare >, conditional_t< Kind==wet_kind_t::unordered_map, wet_unordered_map< Key, Value, Hash, KeyEqual >, void > > > > wet_impl
Definition: wet.hh:770
iterator_impl(set_t &set, size_t pos)
Definition: wet.hh:582
auto end(Args &&...args) const -> decltype(map_.end(std::forward< Args >(args)...))
Definition: wet.hh:333
const iterator_t & iterator() const
Definition: wet.hh:604
void weight(const weight_t &w)
Definition: wet.hh:79
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
Definition: traits.hh:47
auto find(char k) -> iterator
Definition: wet.hh:713
auto weight_of(const welement< Label, Weight > &m) -> decltype(m.weight())
Definition: wet.hh:132
auto find(key_t k) const -> const_iterator
Definition: wet.hh:689
void for_each(Fun f) const
Definition: wet.hh:312
wet_unordered_map(const std::initializer_list< value_type > &l)
Definition: wet.hh:287
typename map_t::iterator iterator
Definition: wet.hh:282
void set(const key_t &k, const value_t &v)
Definition: wet.hh:301
auto erase(const_iterator pos) -> iterator
Definition: wet.hh:455
boost::dynamic_bitset<> set_t
Definition: wet.hh:500
auto size(Args &&...args) const -> decltype(map_.size(std::forward< Args >(args)...))
Definition: wet.hh:337
auto empty(Args &&...args) const -> decltype(map_.empty(std::forward< Args >(args)...))
Definition: wet.hh:256
typename map_t::value_type value_type
Definition: wet.hh:281
void set(const char k, value_t v=true)
Definition: wet.hh:662
const label_t & label() const
Definition: wet.hh:34
auto emplace(Args &&...args) -> decltype(map_.emplace(std::forward< Args >(args)...))
Definition: wet.hh:327
auto cend() const -> const_iterator
Definition: wet.hh:439
constexpr wet_kind_t wet_kind()
Definition: wet.hh:747
auto begin() -> iterator
Definition: wet.hh:641
auto find(Args &&...args) const -> decltype(map_.find(std::forward< Args >(args)...))
Definition: wet.hh:250
auto begin() const -> const_iterator
Definition: wet.hh:647
static constexpr wet_kind_t kind
Definition: wet.hh:277
void weight(const weight_t &k)
Definition: wet.hh:64
void set(const iterator &, const value_t v=true)
Definition: wet.hh:668
auto end(Args &&...args) const -> decltype(map_.end(std::forward< Args >(args)...))
Definition: wet.hh:253
wet_bitset(size_t size)
Definition: wet.hh:520
weight_t weight() const
Definition: wet.hh:78
auto end() -> iterator
Definition: wet.hh:642
wet< label_t_of< Context >, weight_t_of< Context >, Kind, vcsn::less< labelset_t_of< Context >>, vcsn::hash< labelset_t_of< Context >>, vcsn::equal_to< labelset_t_of< Context >>> wet_of
The corresponding wet for a LabelSet -> WeightSet context.
Definition: wet.hh:791
auto end() const -> const_iterator
Definition: wet.hh:648
welement(const label_t &l, const weight_t &w)
Definition: wet.hh:101
wet_bitset(const std::initializer_list< value_type > &p)
Definition: wet.hh:524
auto begin() const -> const_iterator
Definition: wet.hh:440
auto end() const -> const_iterator
Definition: wet.hh:441
void increment()
Advance to next position.
Definition: wet.hh:405
void weight_set(welement< Label, Weight > &m, const Weight &w)
Definition: wet.hh:139
static key_t key(char k)
Special for char: map -1 to 255 (MAX_UCHAR), not MAX_INT.
Definition: wet.hh:651
static constexpr wet_kind_t kind
Definition: wet.hh:356
auto cbegin() const -> const_iterator
Definition: wet.hh:644
static constexpr wet_kind_t kind
Definition: wet.hh:505
iterator_impl(const iterator_impl< OtherValue, OtherSet > &that)
Definition: wet.hh:577
auto clear(Args &&...args) -> decltype(set_.clear(std::forward< Args >(args)...))
Definition: wet.hh:485
typename map_t::mapped_type mapped_type
Definition: wet.hh:199
void erase(key_t k)
Definition: wet.hh:679
wet_set(const std::initializer_list< value_type > &p)
Definition: wet.hh:363
auto erase(Args &&...args) -> decltype(map_.erase(std::forward< Args >(args)...))
Definition: wet.hh:332
auto begin(Args &&...args) const -> decltype(map_.begin(std::forward< Args >(args)...))
Definition: wet.hh:329
void label(const label_t &l)
Definition: wet.hh:35
void erase(char k)
Definition: wet.hh:684
auto find(char k) const -> const_iterator
Definition: wet.hh:707
friend class boost::iterator_core_access
Definition: wet.hh:402
void set(const key_t &k, const value_t &v)
Definition: wet.hh:443
auto clear(Args &&...args) -> decltype(map_.clear(std::forward< Args >(args)...))
Definition: wet.hh:328
auto clear(Args &&...args) -> decltype(map_.clear(std::forward< Args >(args)...))
Definition: wet.hh:248
static const key_t & key_of(const value_type &p)
Definition: wet.hh:210
auto empty(Args &&...args) const -> decltype(set_.empty(std::forward< Args >(args)...))
Definition: wet.hh:487
welement_t operator*() const
Definition: wet.hh:609
typename std::conditional< B, T, U >::type conditional_t
Definition: type_traits.hh:13
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
Definition: traits.hh:50
static constexpr size_t npos
Definition: wet.hh:560