aGrUM  0.13.2
bijection.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
31 #ifndef GUM_BIJECTION_H
32 #define GUM_BIJECTION_H
33 
34 #include <initializer_list>
35 #include <iostream>
36 #include <sstream>
37 #include <string>
38 #include <type_traits>
39 
40 #include <agrum/core/hashTable.h>
41 
42 namespace gum {
43 
44 #ifndef DOXYGEN_SHOULD_SKIP_THIS
45 
46  template < typename T1, typename T2 >
47  class BijectionIteratorSafe;
48  template < typename T1, typename T2 >
49  class BijectionIterator;
50  template < typename T1, typename T2, typename Alloc, bool >
51  class BijectionImplementation;
52  template < typename T1, typename T2, typename Alloc >
53  class Bijection;
54 
55 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
56 
57 
58  // ===========================================================================
59  // === NON SCALAR BIJECTION IMPLEMENTATION ===
60  // ===========================================================================
61 
82  template < typename T1, typename T2, typename Alloc, bool Gen >
84  public:
87  using type1_type = T1;
88  using type1_reference = T1&;
89  using type1_const_reference = const T1&;
90  using type1_pointer = T1*;
91  using type1_const_pointer = const T1*;
92  using type2_type = T2;
93  using type2_reference = T2&;
94  using type2_const_reference = const T2&;
95  using type2_pointer = T2*;
96  using type2_const_pointer = const T2*;
97  using size_type = std::size_t;
98  using difference_type = std::ptrdiff_t;
99  using allocator_type = Alloc;
104  using allocator12_type =
105  typename Alloc::template rebind< std::pair< T1, T2* > >::other;
106  using allocator21_type =
107  typename Alloc::template rebind< std::pair< T2, T1* > >::other;
109 
110  private:
118  BijectionImplementation(Size size, bool resize_policy);
119 
124  BijectionImplementation(std::initializer_list< std::pair< T1, T2 > > list);
125 
132 
137  template < typename OtherAlloc >
140 
147 
148  public:
149  // ============================================================================
151  // ============================================================================
153 
158 
160 
161  private:
167  BijectionImplementation< T1, T2, Alloc, Gen >&
168  operator=(const BijectionImplementation< T1, T2, Alloc, Gen >& toCopy);
169 
175  template < typename OtherAlloc >
176  BijectionImplementation< T1, T2, Alloc, Gen >&
177  operator=(const BijectionImplementation< T1, T2, OtherAlloc, Gen >& toCopy);
178 
184  BijectionImplementation< T1, T2, Alloc, Gen >&
185  operator=(BijectionImplementation< T1, T2, Alloc, Gen >&& toCopy);
186 
187  public:
188  // ============================================================================
190  // ============================================================================
192 
214  iterator begin() const;
215 
237  const_iterator cbegin() const;
238 
259  const iterator& end() const noexcept;
260 
281  const const_iterator& cend() const noexcept;
282 
304  iterator_safe beginSafe() const;
305 
329 
351  const iterator_safe& endSafe() const noexcept;
352 
375  const const_iterator_safe& cendSafe() const noexcept;
376 
412  static const iterator_safe& endSafe4Statics();
413 
449  static const iterator& end4Statics();
450 
452  // ============================================================================
454  // ============================================================================
456 
463  const T1& first(const T2& second) const;
464 
474  const T1& firstWithDefault(const T2& second, const T1& default_val) const;
475 
482  const T2& second(const T1& first) const;
483 
493  const T2& secondWithDefault(const T1& second, const T2& default_val) const;
494 
502  bool existsFirst(const T1& first) const;
503 
511  bool existsSecond(const T2& second) const;
512 
522  void insert(const T1& first, const T2& second);
523 
533  void insert(T1&& first, T2&& second);
534 
545  template < typename... Args >
546  void emplace(Args&&... args);
547 
551  void clear();
552 
559  bool empty() const noexcept;
560 
567  Size size() const noexcept;
568 
577  void eraseFirst(const T1& first);
578 
587  void eraseSecond(const T2& second);
588 
593  std::string toString() const;
594 
596  // ============================================================================
598  // ============================================================================
600 
605  Size capacity() const noexcept;
606 
614  void resize(Size new_size);
615 
623  void setResizePolicy(const bool new_policy) noexcept;
624 
632  bool resizePolicy() const noexcept;
633 
635 
636  private:
642 
645  friend class BijectionIteratorSafe< T1, T2 >;
646  friend class BijectionIterator< T1, T2 >;
647  friend class Bijection< T1, T2, Alloc >;
648  template < typename TT1, typename TT2, typename A, bool >
649  friend class BijectionImplementation;
651 
652  // Below, we create the two gum::HashTable used by the gum::Bijection. Note
653  // that the values of these gum::HashTable are pointers. This enables to
654  // create only once objects (T1,T2). When using gum::Bijection with large
655  // size objects, this feature is of particular interest.
656 
659 
662 
672  template < typename OtherAlloc >
673  void __copy(const HashTable< T1, T2*, OtherAlloc >& source);
674 
681  typename HashTable12::value_type* __insert(const T1& first, const T2& second);
682 
689  typename HashTable12::value_type* __insert(T1&& first, T2&& second);
690  };
691 
692 #ifndef DOXYGEN_SHOULD_SKIP_THIS
693 
694  // ===========================================================================
695  // === SCALAR BIJECTION IMPLEMENTATION ===
696  // ===========================================================================
697 
721  template < typename T1, typename T2, typename Alloc >
722  class BijectionImplementation< T1, T2, Alloc, true > {
723  public:
726  using type1_type = T1;
727  using type1_reference = T1&;
728  using type1_const_reference = const T1&;
729  using type1_pointer = T1*;
730  using type1_const_pointer = const T1*;
731  using type2_type = T2;
732  using type2_reference = T2&;
733  using type2_const_reference = const T2&;
734  using type2_pointer = T2*;
735  using type2_const_pointer = const T2*;
736  using size_type = std::size_t;
737  using difference_type = std::ptrdiff_t;
738  using allocator_type = Alloc;
743 
744  using allocator12_type =
745  typename Alloc::template rebind< std::pair< T1, T2 > >::other;
746  using allocator21_type =
747  typename Alloc::template rebind< std::pair< T2, T1 > >::other;
749 
750  private:
758  BijectionImplementation(Size size, bool resize_policy);
759 
764  BijectionImplementation(std::initializer_list< std::pair< T1, T2 > > list);
765 
772 
777  template < typename OtherAlloc >
780 
787 
788  public:
789  // ============================================================================
791  // ============================================================================
793 
798 
800 
801  private:
809 
815  template < typename OtherAlloc >
818 
826 
827  public:
828  // ============================================================================
830  // ============================================================================
832 
854  iterator begin() const;
855 
877  const_iterator cbegin() const;
878 
899  const iterator& end() const noexcept;
900 
921  const const_iterator& cend() const noexcept;
922 
944  iterator_safe beginSafe() const;
945 
969 
991  const iterator_safe& endSafe() const noexcept;
992 
1015  const const_iterator_safe& cendSafe() const noexcept;
1016 
1052  static const iterator_safe& endSafe4Statics();
1053 
1089  static const iterator& end4Statics();
1090 
1092  // ============================================================================
1094  // ============================================================================
1096 
1103  const T1& first(T2 second) const;
1104 
1114  const T1& firstWithDefault(T2 second, T1 default_val) const;
1115 
1122  const T2& second(T1 first) const;
1123 
1133  const T2& secondWithDefault(T1 first, T2 default_val) const;
1134 
1142  bool existsFirst(T1 first) const;
1143 
1151  bool existsSecond(T2 second) const;
1152 
1162  void insert(T1 first, T2 second);
1163 
1174  template < typename... Args >
1175  void emplace(Args&&... args);
1176 
1180  void clear();
1181 
1188  bool empty() const noexcept;
1189 
1196  Size size() const noexcept;
1197 
1206  void eraseFirst(T1 first);
1207 
1216  void eraseSecond(T2 second);
1217 
1222  std::string toString() const;
1223 
1225  // ============================================================================
1227  // ============================================================================
1229 
1234  Size capacity() const noexcept;
1235 
1243  void resize(Size new_size);
1244 
1252  void setResizePolicy(const bool new_policy) noexcept;
1253 
1261  bool resizePolicy() const noexcept;
1262 
1264 
1265  private:
1271 
1274  friend class BijectionIteratorSafe< T1, T2 >;
1275  friend class BijectionIterator< T1, T2 >;
1276  friend class Bijection< T1, T2, Alloc >;
1277  template < typename TT1, typename TT2, typename A, bool >
1278  friend class BijectionImplementation;
1280 
1281  // Below, we create the two gum::HashTable used by the gum::Bijection. Note
1282  // that the values of these gum::HashTable are pointers. This enables to
1283  // create only once objects (T1,T2). When using gum::Bijection with large
1284  // size objects, this feature is of particular interest.
1285 
1288 
1291 
1301  template < typename OtherAlloc >
1302  void __copy(const HashTable< T1, T2, OtherAlloc >& f2s);
1303 
1310  void __insert(const T1 first, const T2 second);
1311  };
1312 
1313 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1314 
1327  template < typename T1, typename T2, typename Alloc, bool >
1328  friend class BijectionImplementation;
1329 
1330  private:
1333 
1336 
1343 
1349  };
1350 
1360  template < bool gen >
1367  template < typename T >
1368  INLINE static const T& op_second(const T* x) {
1369  return *x;
1370  }
1371  };
1372 
1382  template <>
1383  struct BijectionIteratorGet< true > {
1389  template < typename T >
1390  INLINE static const T& op_second(const T& x) {
1391  return x;
1392  }
1393  };
1394 
1395  // ===========================================================================
1396  // === BIJECTION SAFE ITERATORS ===
1397  // ===========================================================================
1398 
1408  template < typename T1, typename T2 >
1410  template < typename TT1, typename TT2, typename Alloc, bool >
1411  friend class BijectionImplementation;
1412 
1413  public:
1416  using iterator_category = std::forward_iterator_tag;
1417  using type1_type = T1;
1418  using type1_reference = T1&;
1419  using type1_const_reference = const T1&;
1420  using type1_pointer = T1*;
1421  using type1_const_pointer = const T1*;
1422  using type2_type = T2;
1423  using type2_reference = T2&;
1424  using type2_const_reference = const T2&;
1425  using type2_pointer = T2*;
1426  using type2_const_pointer = const T2*;
1427  using difference_type = std::ptrdiff_t;
1429 
1430  private:
1436  && std::is_scalar< T2 >::value >;
1437 
1444  template < typename Alloc, bool Gen >
1447 
1448  public:
1449  // ============================================================================
1451  // ============================================================================
1453 
1457  BijectionIteratorSafe() noexcept;
1458 
1463  template < typename Alloc >
1464  BijectionIteratorSafe(const Bijection< T1, T2, Alloc >& bijection);
1465 
1470  BijectionIteratorSafe(const BijectionIteratorSafe< T1, T2 >& from);
1471 
1476  BijectionIteratorSafe(BijectionIteratorSafe< T1, T2 >&& from) noexcept;
1477 
1481  ~BijectionIteratorSafe() noexcept;
1482 
1484  // ============================================================================
1486  // ============================================================================
1488 
1494  BijectionIteratorSafe< T1, T2 >&
1495  operator=(const BijectionIteratorSafe< T1, T2 >& toCopy);
1496 
1502  BijectionIteratorSafe< T1, T2 >&
1503  operator=(BijectionIteratorSafe< T1, T2 >&& toMove) noexcept;
1504 
1511  BijectionIteratorSafe< T1, T2 >& operator++() noexcept;
1512 
1524  BijectionIteratorSafe< T1, T2 >& operator+=(unsigned int nb) noexcept;
1525 
1537  BijectionIteratorSafe< T1, T2 > operator+(unsigned int nb) noexcept;
1538 
1544  bool operator!=(const BijectionIteratorSafe< T1, T2 >& toCompare) const
1545  noexcept;
1546 
1552  bool operator==(const BijectionIteratorSafe< T1, T2 >& toCompare) const
1553  noexcept;
1554 
1556  // ============================================================================
1558  // ============================================================================
1560 
1567  const T1& first() const;
1568 
1575  const T2& second() const;
1576 
1578 
1579  private:
1581  using HashTable12 = typename std::conditional<
1582  std::is_scalar< T1 >::value && std::is_scalar< T2 >::value,
1583  HashTable< T1, T2, std::allocator< std::pair< T1, T2 > > >,
1584  HashTable< T1, T2*, std::allocator< std::pair< T1, T2* > > > >::type;
1585 
1589 
1591  HashIter __iter;
1592  };
1593 
1594  // ===========================================================================
1595  // === BIJECTION UNSAFE ITERATORS ===
1596  // ===========================================================================
1606  template < typename T1, typename T2 >
1608  template < typename TT1, typename TT2, typename Alloc, bool >
1609  friend class BijectionImplementation;
1610 
1611  public:
1614  using iterator_category = std::forward_iterator_tag;
1615  using type1_type = T1;
1616  using type1_reference = T1&;
1617  using type1_const_reference = const T1&;
1618  using type1_pointer = T1*;
1619  using type1_const_pointer = const T1*;
1620  using type2_type = T2;
1621  using type2_reference = T2&;
1622  using type2_const_reference = const T2&;
1623  using type2_pointer = T2*;
1624  using type2_const_pointer = const T2*;
1625  using difference_type = std::ptrdiff_t;
1627 
1628  private:
1634  && std::is_scalar< T2 >::value >;
1635 
1640  template < typename Alloc, bool Gen >
1641  BijectionIterator(
1643 
1644  public:
1645  // ============================================================================
1647  // ============================================================================
1649 
1653  BijectionIterator() noexcept;
1654 
1659  template < typename Alloc >
1660  BijectionIterator(const Bijection< T1, T2, Alloc >& bijection);
1661 
1666  BijectionIterator(const BijectionIterator< T1, T2 >& from);
1667 
1672  BijectionIterator(BijectionIterator< T1, T2 >&& from) noexcept;
1673 
1677  ~BijectionIterator() noexcept;
1678 
1680  // ============================================================================
1682  // ============================================================================
1684 
1690  BijectionIterator< T1, T2 >&
1691  operator=(const BijectionIterator< T1, T2 >& toCopy);
1692 
1698  BijectionIterator< T1, T2 >&
1699  operator=(BijectionIterator< T1, T2 >&& toMove) noexcept;
1700 
1708  BijectionIterator< T1, T2 >& operator++() noexcept;
1709 
1721  BijectionIterator< T1, T2 >& operator+=(unsigned int nb) noexcept;
1722 
1731  BijectionIterator< T1, T2 > operator+(unsigned int nb) noexcept;
1732 
1738  bool operator!=(const BijectionIterator< T1, T2 >& toCompare) const noexcept;
1739 
1745  bool operator==(const BijectionIterator< T1, T2 >& toCompare) const noexcept;
1746 
1748  // ============================================================================
1750  // ============================================================================
1752 
1759  const T1& first() const;
1760 
1767  const T2& second() const;
1768 
1770 
1771  private:
1773  using HashTable12 = typename std::conditional<
1774  std::is_scalar< T1 >::value && std::is_scalar< T2 >::value,
1775  HashTable< T1, T2, std::allocator< std::pair< T1, T2 > > >,
1776  HashTable< T1, T2*, std::allocator< std::pair< T1, T2* > > > >::type;
1778 
1780  HashIter __iter;
1781  };
1782 
1802  template < typename T1, typename T2, typename Alloc = std::allocator< T2 > >
1804  : public BijectionImplementation< T1,
1805  T2,
1806  Alloc,
1807  std::is_scalar< T1 >::value
1808  && std::is_scalar< T2 >::value > {
1809  public:
1812  using type1_type = T1;
1813  using type1_reference = T1&;
1814  using type1_const_reference = const T1&;
1815  using type1_pointer = T1*;
1816  using type1_const_pointer = const T1*;
1817  using type2_type = T2;
1818  using type2_reference = T2&;
1819  using type2_const_reference = const T2&;
1820  using type2_pointer = T2*;
1821  using type2_const_pointer = const T2*;
1822  using size_type = std::size_t;
1823  using difference_type = std::ptrdiff_t;
1824  using allocator_type = Alloc;
1826  using const_iterator = BijectionIterator< T1, T2 >;
1828  using const_iterator_safe = BijectionIteratorSafe< T1, T2 >;
1829 
1830  using allocator1_type = typename Alloc::template rebind< T1* >::other;
1831  using allocator2_type = typename Alloc::template rebind< T2* >::other;
1833 
1835  using Implementation =
1836  BijectionImplementation< T1,
1837  T2,
1838  Alloc,
1839  std::is_scalar< T1 >::value
1840  && std::is_scalar< T2 >::value >;
1841 
1842  // ============================================================================
1844  // ============================================================================
1846 
1855  bool resize_policy = HashTableConst::default_resize_policy);
1856 
1861  Bijection(std::initializer_list< std::pair< T1, T2 > > list);
1862 
1867  Bijection(const Bijection< T1, T2, Alloc >& toCopy);
1868 
1874  template < typename OtherAlloc >
1876 
1881  Bijection(Bijection< T1, T2, Alloc >&& from) noexcept;
1882 
1886  ~Bijection();
1887 
1889  // ============================================================================
1891  // ============================================================================
1893 
1899  Bijection< T1, T2, Alloc >&
1900  operator=(const Bijection< T1, T2, Alloc >& toCopy);
1901 
1907  template < typename OtherAlloc >
1908  Bijection< T1, T2, Alloc >&
1909  operator=(const Bijection< T1, T2, OtherAlloc >& toCopy);
1910 
1915  Bijection< T1, T2, Alloc >& operator=(Bijection< T1, T2, Alloc >&& bij);
1916 
1918  };
1919 
1929  template < typename T1, typename T2, typename Alloc >
1930  std::ostream& operator<<(std::ostream&,
1931  const Bijection< T1, T2, Alloc >& bijection);
1932 
1933 } /* namespace gum */
1934 
1935 
1936 extern template class gum::Bijection< int, int >;
1937 extern template class gum::Bijection< std::string, std::string >;
1938 
1939 
1940 // always include the template implementations
1941 #include <agrum/core/bijection_tpl.h>
1942 
1943 #endif /* GUM_BIJECTION_H */
void insert(const T1 &first, const T2 &second)
Inserts a new association in the gum::Bijection.
friend class BijectionImplementation
a friend to speed-up accesses
Definition: bijection.h:649
unsigned long Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:50
void __copy(const HashTable< T1, T2 *, OtherAlloc > &source)
A function that performs a complete copy of another gum::Bijection.
const T2 & second(const T1 &first) const
Returns the second value of a pair given its first value.
void clear()
Removes all the associations from the gum::Bijection.
BijectionImplementation< T1, T2, Alloc, Gen > & operator=(const BijectionImplementation< T1, T2, Alloc, Gen > &toCopy)
Copy operator.
Dummy classes for discriminating scalars and non-scalars operators and -> wihtout any overhead...
Definition: bijection.h:1361
const_iterator cbegin() const
Returns the constant unsafe iterator at the beginning of the gum::Bjection.
std::forward_iterator_tag iterator_category
types for STL compliance
Definition: bijection.h:1416
void eraseFirst(const T1 &first)
Erases an association containing the given first element.
bool existsFirst(const T1 &first) const
Returns true if first is the first element in a pair in the gum::Bijection.
Safe iterators for bijectionIterator.
Definition: bijection.h:1409
typename std::allocator< const std::string * >::template rebind< std::pair< Idx, const std::string ** > >::other allocator12_type
Definition: bijection.h:105
STL namespace.
static constexpr Size default_size
The default number of slots in hashtables.
Definition: hashTable.h:77
typename std::conditional< std::is_scalar< int >::value &&std::is_scalar< int >::value, HashTable< int, int, std::allocator< std::pair< int, int > > >, HashTable< int, int *, std::allocator< std::pair< int, int * > > > >::type HashTable12
Alias for one of the internal gum::HashTable of the gum::Bijection.
Definition: bijection.h:1776
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
static const iterator_safe & endSafe4Statics()
Returns the safe end iterator for other classes&#39; statics.
Definition: bijection_tpl.h:39
void resize(Size new_size)
Manually resize the gum::Bijection.
const_iterator_safe cbeginSafe() const
Returns the constant safe iterator at the begining of the gum::Bijection.
const const_iterator_safe & cendSafe() const noexcept
Returns the constant safe iterator at the end of the gum::Bijection.
const T2 & secondWithDefault(const T1 &second, const T2 &default_val) const
Returns the second value of a pair given its first value or default_val if first is unfound...
static INLINE const T & op_second(const T *x)
Returns a refeence over a pointer.
Definition: bijection.h:1368
void eraseSecond(const T2 &second)
Erases an association containing the given second element.
BijectionIteratorSafe< T1, T2 > const_iterator_safe
types for STL compliance
Definition: bijection.h:103
Size capacity() const noexcept
Returns the number of hashtables slots used.
A class which creates the static iterator used by gim::Bijections.
Definition: bijection.h:1325
const iterator & end() const noexcept
Returns the unsafe iterator at the end of the gum::Bijection.
bool empty() const noexcept
Returns true if the gum::Bijection doesn&#39;t contain any association.
HashTable12 __firstToSecond
The gum::HashTable associating T2 objects to T1 objects.
Definition: bijection.h:658
Unsafe iterators for bijection.
Definition: bijection.h:1607
static constexpr bool default_resize_policy
A Boolean indicating whether inserting too many values into the hashtable makes it resize itself auto...
Definition: hashTable.h:91
iterator begin() const
Returns the unsafe iterator at the beginning of the gum::Bijection.
typename std::allocator< NodeId >::template rebind< NodeId * >::other allocator2_type
Definition: bijection.h:1831
bool existsSecond(const T2 &second) const
Returns true if second is the second element in a pair in the gum::Bijection.
Set of pairs of elements with fast search for both elements.
Definition: bijection.h:1803
iterator_safe beginSafe() const
Returns the safe iterator at the beginning of the gum::Bijection.
typename std::allocator< NodeId >::template rebind< gum::learning::GraphChange * >::other allocator1_type
Definition: bijection.h:1830
const const_iterator & cend() const noexcept
Returns the constant iterator at the end of the gum::Bijection.
static const BijectionIterator< int, int > * __BijectionIterEnd
The unsafe iterator used by everyone.
Definition: bijection.h:1335
std::string toString() const
Returns a friendly representatin of the gum::Bijection.
Size size() const noexcept
Returns the number of associations stored within the gum::Bijection.
~BijectionImplementation()
Destructor.
typename HashTable12::const_iterator HashIter
Definition: bijection.h:1777
typename std::conditional< std::is_scalar< NodeId >::value &&std::is_scalar< GUM_SCALAR >::value, HashTable< NodeId, GUM_SCALAR, std::allocator< std::pair< NodeId, GUM_SCALAR > > >, HashTable< NodeId, GUM_SCALAR *, std::allocator< std::pair< NodeId, GUM_SCALAR * > > > >::type HashTable12
Alias for one of the internal gum::HashTable of the gum::Bijection.
Definition: bijection.h:1584
static INLINE const T & op_second(const T &x)
Returns a reference.
Definition: bijection.h:1390
BijectionIterator< T1, T2 > const_iterator
types for STL compliance
Definition: bijection.h:101
static const BijectionIteratorSafe< int, int > * __BijectionIterEndSafe
The safe iterator used by everyone.
Definition: bijection.h:1332
bool resizePolicy() const noexcept
Returns true if the resize policy is automatic.
const iterator_safe & endSafe() const noexcept
Returns the safe iterator at the end of the gum::Bijection.
typename HashTable12::const_iterator_safe HashIter
Alias for one of the internal gum::HastTableIterator of the gum::Bijection.
Definition: bijection.h:1588
std::forward_iterator_tag iterator_category
types for STL compliance
Definition: bijection.h:1614
typename std::allocator< const std::string * >::template rebind< std::pair< const std::string *, Idx * > >::other allocator21_type
Definition: bijection.h:107
static const iterator & end4Statics()
Returns the unsafe end iterator for other classes&#39; statics.
Definition: bijection_tpl.h:47
HashTable21 __secondToFirst
The gum::HashTable associating T1 objects to T2 objects.
Definition: bijection.h:661
const T1 & first(const T2 &second) const
Returns the first value of a pair given its second value.
HashTable12::value_type * __insert(const T1 &first, const T2 &second)
Inserts a new association into the gum::Bijection.
void setResizePolicy(const bool new_policy) noexcept
Change the gum::Bijection resizing policy.
Class hash tables iterators.
A non scalar implementation of a Bijection.
Definition: bijection.h:83
void emplace(Args &&...args)
Emplace a new element in the gum::Bijection.
const T1 & firstWithDefault(const T2 &second, const T1 &default_val) const
Returns the first value of a pair given its second value or default_val if second is unfound...