aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
bijection.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2025 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41
52#ifndef GUM_BIJECTION_H
53#define GUM_BIJECTION_H
54
55#include <iostream>
56#include <sstream>
57#include <string>
58
60
61#include <initializer_list>
62#include <type_traits>
63
64namespace gum {
65
66#ifndef DOXYGEN_SHOULD_SKIP_THIS
67
68 template < typename T1, typename T2 >
70 template < typename T1, typename T2 >
72 template < typename T1, typename T2, bool >
74 template < typename T1, typename T2 >
75 class Bijection;
76
77#endif /* DOXYGEN_SHOULD_SKIP_THIS */
78
79
80 // ===========================================================================
81 // === NON SCALAR BIJECTION IMPLEMENTATION ===
82 // ===========================================================================
83
103 template < typename T1, typename T2, bool Gen >
105 public:
108 using type1_type = T1;
109 using type1_reference = T1&;
110 using type1_const_reference = const T1&;
111 using type1_pointer = T1*;
112 using type1_const_pointer = const T1*;
113 using type2_type = T2;
114 using type2_reference = T2&;
115 using type2_const_reference = const T2&;
116 using type2_pointer = T2*;
117 using type2_const_pointer = const T2*;
118 using size_type = std::size_t;
119 using difference_type = std::ptrdiff_t;
125
126 private:
134 BijectionImplementation(Size size, bool resize_policy);
135
140 BijectionImplementation(std::initializer_list< std::pair< T1, T2 > > list);
141
147
153
154 public:
155 // ============================================================================
157 // ============================================================================
159
164
166
167 private:
175
183
184 public:
185 // ============================================================================
187 // ============================================================================
189
212
235
256 const iterator& end() const noexcept;
257
278 const const_iterator& cend() const noexcept;
279
302
326
348 const iterator_safe& endSafe() const noexcept;
349
372 const const_iterator_safe& cendSafe() const noexcept;
373
375
376 // ============================================================================
378 // ============================================================================
380
387 const T1& first(const T2& second) const;
388
398 const T1& firstWithDefault(const T2& second, const T1& default_val) const;
399
406 const T2& second(const T1& first) const;
407
417 const T2& secondWithDefault(const T1& second, const T2& default_val) const;
418
426 bool existsFirst(const T1& first) const;
427
435 bool existsSecond(const T2& second) const;
436
446 void insert(const T1& first, const T2& second);
447
457 void insert(T1&& first, T2&& second);
458
469 template < typename... Args >
470 void emplace(Args&&... args);
471
475 void clear();
476
483 bool empty() const noexcept;
484
491 Size size() const noexcept;
492
501 void eraseFirst(const T1& first);
502
511 void eraseSecond(const T2& second);
512
517 std::string toString() const;
518
520 // ============================================================================
522 // ============================================================================
524
529 Size capacity() const noexcept;
530
538 void resize(Size new_size);
539
547 void setResizePolicy(const bool new_policy) noexcept;
548
556 bool resizePolicy() const noexcept;
557
559
560 private:
563 using HashTable12 = HashTable< T1, T2* >;
564 using HashTable21 = HashTable< T2, T1* >;
566
569 friend class BijectionIteratorSafe< T1, T2 >;
570 friend class BijectionIterator< T1, T2 >;
571 friend class Bijection< T1, T2 >;
572 template < typename TT1, typename TT2, bool >
575
576 // Below, we create the two gum::HashTable used by the gum::Bijection. Note
577 // that the values of these gum::HashTable are pointers. This enables to
578 // create only once objects (T1,T2). When using gum::Bijection with large
579 // size objects, this feature is of particular interest.
580
583
586
595 void _copy_(const HashTable< T1, T2* >& source);
596
603 typename HashTable12::value_type* _insert_(const T1& first, const T2& second);
604
611 typename HashTable12::value_type* _insert_(T1&& first, T2&& second);
612 };
613
614#ifndef DOXYGEN_SHOULD_SKIP_THIS
615
616 // ===========================================================================
617 // === SCALAR BIJECTION IMPLEMENTATION ===
618 // ===========================================================================
619
642 template < typename T1, typename T2 >
643 class BijectionImplementation< T1, T2, true > {
644 public:
647 using type1_type = T1;
648 using type1_reference = T1&;
649 using type1_const_reference = const T1&;
650 using type1_pointer = T1*;
651 using type1_const_pointer = const T1*;
652 using type2_type = T2;
653 using type2_reference = T2&;
654 using type2_const_reference = const T2&;
655 using type2_pointer = T2*;
656 using type2_const_pointer = const T2*;
657 using size_type = std::size_t;
658 using difference_type = std::ptrdiff_t;
664
665 private:
673 BijectionImplementation(Size size, bool resize_policy);
674
679 BijectionImplementation(std::initializer_list< std::pair< T1, T2 > > list);
680
686
692
693 public:
694 // ============================================================================
696 // ============================================================================
698
703
705
706 private:
714
722
723 public:
724 // ============================================================================
726 // ============================================================================
728
750 iterator begin() const;
751
773 const_iterator cbegin() const;
774
795 const iterator& end() const noexcept;
796
817 const const_iterator& cend() const noexcept;
818
840 iterator_safe beginSafe() const;
841
865
887 const iterator_safe& endSafe() const noexcept;
888
911 const const_iterator_safe& cendSafe() const noexcept;
912
914
915 // ============================================================================
917 // ============================================================================
919
926 const T1& first(T2 second) const;
927
937 const T1& firstWithDefault(T2 second, T1 default_val) const;
938
945 const T2& second(T1 first) const;
946
956 const T2& secondWithDefault(T1 first, T2 default_val) const;
957
965 bool existsFirst(T1 first) const;
966
974 bool existsSecond(T2 second) const;
975
985 void insert(T1 first, T2 second);
986
997 template < typename... Args >
998 void emplace(Args&&... args);
999
1003 void clear();
1004
1011 bool empty() const noexcept;
1012
1019 Size size() const noexcept;
1020
1029 void eraseFirst(T1 first);
1030
1039 void eraseSecond(T2 second);
1040
1045 std::string toString() const;
1046
1048 // ============================================================================
1050 // ============================================================================
1052
1057 Size capacity() const noexcept;
1058
1066 void resize(Size new_size);
1067
1075 void setResizePolicy(const bool new_policy) noexcept;
1076
1084 bool resizePolicy() const noexcept;
1085
1087
1088 private:
1094
1097 friend class BijectionIteratorSafe< T1, T2 >;
1098 friend class BijectionIterator< T1, T2 >;
1099 friend class Bijection< T1, T2 >;
1100 template < typename TT1, typename TT2, bool >
1101 friend class BijectionImplementation;
1103
1104 // Below, we create the two gum::HashTable used by the gum::Bijection. Note
1105 // that the values of these gum::HashTable are pointers. This enables to
1106 // create only once objects (T1,T2). When using gum::Bijection with large
1107 // size objects, this feature is of particular interest.
1108
1111
1114
1123 void _copy_(const HashTable< T1, T2 >& f2s);
1124
1131 void _insert_(const T1 first, const T2 second);
1132 };
1133
1134#endif /* DOXYGEN_SHOULD_SKIP_THIS */
1135
1145 template < bool gen >
1152 template < typename T >
1153 INLINE static const T& op_second(const T* x) {
1154 return *x;
1155 }
1156 };
1157
1167 template <>
1168 struct BijectionIteratorGet< true > {
1174 template < typename T >
1175 INLINE static const T& op_second(const T& x) {
1176 return x;
1177 }
1178 };
1179
1180 // ===========================================================================
1181 // === BIJECTION SAFE ITERATORS ===
1182 // ===========================================================================
1183
1193 template < typename T1, typename T2 >
1195 template < typename TT1, typename TT2, bool >
1197
1198 public:
1201 using iterator_category = std::forward_iterator_tag;
1202 using type1_type = T1;
1203 using type1_reference = T1&;
1204 using type1_const_reference = const T1&;
1205 using type1_pointer = T1*;
1206 using type1_const_pointer = const T1*;
1207 using type2_type = T2;
1208 using type2_reference = T2&;
1209 using type2_const_reference = const T2&;
1210 using type2_pointer = T2*;
1211 using type2_const_pointer = const T2*;
1212 using difference_type = std::ptrdiff_t;
1214
1215 private:
1221 = BijectionIteratorGet< std::is_scalar< T1 >::value && std::is_scalar< T2 >::value >;
1222
1229 template < bool Gen >
1231
1232 public:
1233 // ============================================================================
1235 // ============================================================================
1237
1241 explicit BijectionIteratorSafe() noexcept;
1242
1243#ifndef DOXYGEN_SHOULD_SKIP_THIS
1244 // constructor for the static endSafe iterator
1245 // only bijection.cpp should use this constructor
1246 explicit consteval BijectionIteratorSafe(StaticInitializer init) noexcept : _iter_(init) {}
1247#endif // DOXYGEN_SHOULD_SKIP_THIS
1248
1256
1262
1268
1272 ~BijectionIteratorSafe() noexcept;
1273
1275 // ============================================================================
1277 // ============================================================================
1279
1285 BijectionIteratorSafe< T1, T2 >& operator=(const BijectionIteratorSafe< T1, T2 >& toCopy);
1286
1292 BijectionIteratorSafe< T1, T2 >& operator=(BijectionIteratorSafe< T1, T2 >&& toMove) noexcept;
1293
1300 BijectionIteratorSafe< T1, T2 >& operator++() noexcept;
1301
1313 BijectionIteratorSafe< T1, T2 >& operator+=(Size nb) noexcept;
1314
1326 BijectionIteratorSafe< T1, T2 > operator+(Size nb) noexcept;
1327
1333 bool operator!=(const BijectionIteratorSafe< T1, T2 >& toCompare) const noexcept;
1334
1340 bool operator==(const BijectionIteratorSafe< T1, T2 >& toCompare) const noexcept;
1341
1343 // ============================================================================
1345 // ============================================================================
1347
1354 const T1& first() const;
1355
1362 const T2& second() const;
1363
1365
1366 private:
1368 using HashTable12 =
1369 typename std::conditional< std::is_scalar< T1 >::value && std::is_scalar< T2 >::value,
1370 HashTable< T1, T2 >,
1371 HashTable< T1, T2* > >::type;
1372
1375 using HashIter = typename HashTable12::const_iterator_safe;
1376
1379 };
1380
1381 // ===========================================================================
1382 // === BIJECTION UNSAFE ITERATORS ===
1383 // ===========================================================================
1393 template < typename T1, typename T2 >
1395 template < typename TT1, typename TT2, bool >
1397
1398 public:
1401 using iterator_category = std::forward_iterator_tag;
1402 using type1_type = T1;
1403 using type1_reference = T1&;
1404 using type1_const_reference = const T1&;
1405 using type1_pointer = T1*;
1406 using type1_const_pointer = const T1*;
1407 using type2_type = T2;
1408 using type2_reference = T2&;
1409 using type2_const_reference = const T2&;
1410 using type2_pointer = T2*;
1411 using type2_const_pointer = const T2*;
1412 using difference_type = std::ptrdiff_t;
1414
1415 private:
1421 = BijectionIteratorGet< std::is_scalar< T1 >::value && std::is_scalar< T2 >::value >;
1422
1427 template < bool Gen >
1429
1430 public:
1431 // ============================================================================
1433 // ============================================================================
1435
1439 explicit BijectionIterator() noexcept;
1440
1441#ifndef DOXYGEN_SHOULD_SKIP_THIS
1442 // constructor for the static end iterator
1443 // only bijection.cpp should use this constructor
1444 explicit consteval BijectionIterator(StaticInitializer init) noexcept : _iter_(init) {}
1445#endif // DOXYGEN_SHOULD_SKIP_THIS
1446
1451 BijectionIterator(const Bijection< T1, T2 >& bijection);
1452
1458
1464
1468 ~BijectionIterator() noexcept;
1469
1471 // ============================================================================
1473 // ============================================================================
1475
1481 BijectionIterator< T1, T2 >& operator=(const BijectionIterator< T1, T2 >& toCopy);
1482
1488 BijectionIterator< T1, T2 >& operator=(BijectionIterator< T1, T2 >&& toMove) noexcept;
1489
1497 BijectionIterator< T1, T2 >& operator++() noexcept;
1498
1510 BijectionIterator< T1, T2 >& operator+=(Size nb) noexcept;
1511
1520 BijectionIterator< T1, T2 > operator+(Size nb) noexcept;
1521
1527 bool operator!=(const BijectionIterator< T1, T2 >& toCompare) const noexcept;
1528
1534 bool operator==(const BijectionIterator< T1, T2 >& toCompare) const noexcept;
1535
1537 // ============================================================================
1539 // ============================================================================
1541
1548 const T1& first() const;
1549
1556 const T2& second() const;
1557
1559
1560 private:
1562 using HashTable12 =
1563 typename std::conditional< std::is_scalar< T1 >::value && std::is_scalar< T2 >::value,
1564 HashTable< T1, T2 >,
1565 HashTable< T1, T2* > >::type;
1566 using HashIter = typename HashTable12::const_iterator;
1567
1570 };
1571
1590 template < typename T1, typename T2 >
1592 public BijectionImplementation< T1,
1593 T2,
1594 std::is_scalar< T1 >::value && std::is_scalar< T2 >::value > {
1595 public:
1598 using type1_type = T1;
1599 using type1_reference = T1&;
1600 using type1_const_reference = const T1&;
1601 using type1_pointer = T1*;
1602 using type1_const_pointer = const T1*;
1603 using type2_type = T2;
1604 using type2_reference = T2&;
1605 using type2_const_reference = const T2&;
1606 using type2_pointer = T2*;
1607 using type2_const_pointer = const T2*;
1608 using size_type = std::size_t;
1609 using difference_type = std::ptrdiff_t;
1615
1619 T2,
1620 std::is_scalar< T1 >::value && std::is_scalar< T2 >::value >;
1621
1622 // ============================================================================
1624 // ============================================================================
1626
1635 bool resize_policy = HashTableConst::default_resize_policy);
1636
1641 Bijection(std::initializer_list< std::pair< T1, T2 > > list);
1642
1647 Bijection(const Bijection< T1, T2 >& toCopy);
1648
1653 Bijection(Bijection< T1, T2 >&& from) noexcept;
1654
1658 ~Bijection();
1659
1661 // ============================================================================
1663 // ============================================================================
1665
1672
1678
1680 };
1681
1682
1683#ifndef DOXYGEN_SHOULD_SKIP_THIS
1684 // _static_Bijection_end_ is a 'constant' iterator initialized at compile time
1685 // that represents the end iterators for all bijections (whatever their
1686 // type). This global variable avoids creating the same iterators within every
1687 // Bijection instance (this would be quite inefficient as end is precisely
1688 // identical for all bijections). The same hold for safe end iterators.
1689 // The type of _Bijection_end_ is a pointer to void because C++ allows
1690 // pointers to void to be cast into pointers to other types (and conversely).
1691 // This avoids the painful strict-aliasing rule warning
1692 extern const BijectionIterator< int, int > _static_Bijection_end_;
1693 extern const BijectionIteratorSafe< int, int > _static_Bijection_end_safe_;
1694
1695 inline constexpr void* const _Bijection_end_ = (void* const)&_static_Bijection_end_;
1696 inline constexpr void* const _Bijection_end_safe_ = (void* const)&_static_Bijection_end_safe_;
1697#endif // DOXYGEN_SHOULD_SKIP_THIS
1698
1699
1708 template < typename T1, typename T2 >
1709 std::ostream& operator<<(std::ostream&, const Bijection< T1, T2 >& bijection);
1710
1711} /* namespace gum */
1712
1713
1714#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
1715extern template class gum::Bijection< int, int >;
1716extern template class gum::Bijection< std::string, std::string >;
1717#endif
1718
1719
1720// always include the template implementations
1722
1723#endif /* GUM_BIJECTION_H */
Class providing generic double hash tables.
A non scalar implementation of a Bijection.
Definition bijection.h:104
const iterator & end() const noexcept
Returns the unsafe iterator at the end of the gum::Bijection.
BijectionIteratorSafe< T1, T2 > iterator_safe
types for STL compliance
Definition bijection.h:122
BijectionImplementation(const BijectionImplementation< T1, T2, Gen > &toCopy)
Copy constructor.
BijectionImplementation< T1, T2, Gen > & operator=(BijectionImplementation< T1, T2, Gen > &&toCopy)
Move operator.
T1 type1_type
types for STL compliance
Definition bijection.h:108
std::size_t size_type
types for STL compliance
Definition bijection.h:118
const T2 * type2_const_pointer
types for STL compliance
Definition bijection.h:117
BijectionIteratorSafe< T1, T2 > const_iterator_safe
types for STL compliance
Definition bijection.h:123
HashTable< T2, T1 * > HashTable21
Alias for more readable code.
Definition bijection.h:564
std::ptrdiff_t difference_type
types for STL compliance
Definition bijection.h:119
BijectionIterator< T1, T2 > const_iterator
types for STL compliance
Definition bijection.h:121
T2 * type2_pointer
types for STL compliance
Definition bijection.h:116
BijectionImplementation(std::initializer_list< std::pair< T1, T2 > > list)
Initializer list constructor.
iterator begin() const
Returns the unsafe iterator at the beginning of the gum::Bijection.
const T1 * type1_const_pointer
types for STL compliance
Definition bijection.h:112
BijectionImplementation(Size size, bool resize_policy)
Default constructor: creates a gum::Bijection without any association.
const T1 & type1_const_reference
types for STL compliance
Definition bijection.h:110
const T2 & type2_const_reference
types for STL compliance
Definition bijection.h:115
BijectionIterator< T1, T2 > iterator
types for STL compliance
Definition bijection.h:120
T2 type2_type
types for STL compliance
Definition bijection.h:113
T2 & type2_reference
types for STL compliance
Definition bijection.h:114
T1 & type1_reference
types for STL compliance
Definition bijection.h:109
friend class BijectionIterator< T1, T2 >
a friend to speed-up accesses
Definition bijection.h:570
const_iterator cbegin() const
Returns the constant unsafe iterator at the beginning of the gum::Bjection.
friend class Bijection< T1, T2 >
a friend to speed-up accesses
Definition bijection.h:571
BijectionImplementation(BijectionImplementation< T1, T2, Gen > &&from) noexcept
Move constructor.
HashTable< T1, T2 * > HashTable12
Alias for more readable code.
Definition bijection.h:563
BijectionImplementation< T1, T2, Gen > & operator=(const BijectionImplementation< T1, T2, Gen > &toCopy)
Copy operator.
T1 * type1_pointer
types for STL compliance
Definition bijection.h:111
friend class BijectionIteratorSafe< T1, T2 >
a friend to speed-up accesses
Definition bijection.h:569
friend class BijectionImplementation
a friend to speed-up accesses
Definition bijection.h:573
Safe iterators for bijectionIterator.
Definition bijection.h:1194
T2 * type2_pointer
types for STL compliance
Definition bijection.h:1210
HashIter _iter_
The hashTable iterator that actually does all the job.
Definition bijection.h:1377
const T1 * type1_const_pointer
types for STL compliance
Definition bijection.h:1206
typename HashTable12::const_iterator_safe HashIter
Alias for one of the internal gum::HastTableIterator of the gum::Bijection.
Definition bijection.h:1374
BijectionIteratorGet< std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value > Getter
Dummy classes that will enable discriminate without overhead between scalars and non-scalars function...
Definition bijection.h:1220
const T1 & type1_const_reference
types for STL compliance
Definition bijection.h:1204
T1 * type1_pointer
types for STL compliance
Definition bijection.h:1205
const T2 & type2_const_reference
types for STL compliance
Definition bijection.h:1209
T1 & type1_reference
types for STL compliance
Definition bijection.h:1203
BijectionIteratorSafe(const BijectionImplementation< T1, T2, Gen > &bijection)
Begin constructor.
T1 type1_type
types for STL compliance
Definition bijection.h:1202
const T2 * type2_const_pointer
types for STL compliance
Definition bijection.h:1211
typename std::conditional< std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value, HashTable< T1, T2 >, HashTable< T1, T2 * > >::type HashTable12
Alias for one of the internal gum::HashTable of the gum::Bijection.
Definition bijection.h:1367
std::ptrdiff_t difference_type
types for STL compliance
Definition bijection.h:1212
T2 type2_type
types for STL compliance
Definition bijection.h:1207
std::forward_iterator_tag iterator_category
types for STL compliance
Definition bijection.h:1201
friend class BijectionImplementation
Definition bijection.h:1196
T2 & type2_reference
types for STL compliance
Definition bijection.h:1208
Unsafe iterators for bijection.
Definition bijection.h:1394
T1 * type1_pointer
types for STL compliance
Definition bijection.h:1405
T1 type1_type
types for STL compliance
Definition bijection.h:1402
typename std::conditional< std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value, HashTable< T1, T2 >, HashTable< T1, T2 * > >::type HashTable12
Alias for one of the internal gum::HashTable of the gum::Bijection.
Definition bijection.h:1561
BijectionIterator(const BijectionImplementation< T1, T2, Gen > &bijection)
Begin constructor.
typename HashTable12::const_iterator HashIter
Definition bijection.h:1565
T2 * type2_pointer
types for STL compliance
Definition bijection.h:1410
T1 & type1_reference
types for STL compliance
Definition bijection.h:1403
T2 & type2_reference
types for STL compliance
Definition bijection.h:1408
const T2 & type2_const_reference
types for STL compliance
Definition bijection.h:1409
const T1 & type1_const_reference
types for STL compliance
Definition bijection.h:1404
BijectionIteratorGet< std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value > Getter
Dummy classes that will enable discriminate without overhead between scalars and non-scalars function...
Definition bijection.h:1420
T2 type2_type
types for STL compliance
Definition bijection.h:1407
HashIter _iter_
The hashTable iterator that actually does all the job.
Definition bijection.h:1568
std::ptrdiff_t difference_type
types for STL compliance
Definition bijection.h:1412
std::forward_iterator_tag iterator_category
types for STL compliance
Definition bijection.h:1401
const T1 * type1_const_pointer
types for STL compliance
Definition bijection.h:1406
const T2 * type2_const_pointer
types for STL compliance
Definition bijection.h:1411
friend class BijectionImplementation
Definition bijection.h:1396
Set of pairs of elements with fast search for both elements.
Definition bijection.h:1594
const T1 * type1_const_pointer
types for STL compliance
Definition bijection.h:1602
BijectionImplementation< T1, T2, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value > Implementation
The Implementation of this gum::Bijection.
Definition bijection.h:1617
T2 & type2_reference
types for STL compliance
Definition bijection.h:1604
T2 * type2_pointer
types for STL compliance
Definition bijection.h:1606
const T1 & type1_const_reference
types for STL compliance
Definition bijection.h:1600
BijectionIteratorSafe< T1, T2 > iterator_safe
types for STL compliance
Definition bijection.h:1612
BijectionIteratorSafe< T1, T2 > const_iterator_safe
types for STL compliance
Definition bijection.h:1613
T2 type2_type
types for STL compliance
Definition bijection.h:1603
T1 * type1_pointer
types for STL compliance
Definition bijection.h:1601
Bijection(Size size=HashTableConst::default_size, bool resize_policy=HashTableConst::default_resize_policy)
Default constructor: creates a gum::Bijection without any association.
std::ptrdiff_t difference_type
types for STL compliance
Definition bijection.h:1609
const T2 * type2_const_pointer
types for STL compliance
Definition bijection.h:1607
Bijection< const DiscreteVariable *, const DiscreteVariable * > & operator=(const Bijection< const DiscreteVariable *, const DiscreteVariable * > &toCopy)
T1 type1_type
types for STL compliance
Definition bijection.h:1598
const T2 & type2_const_reference
types for STL compliance
Definition bijection.h:1605
T1 & type1_reference
types for STL compliance
Definition bijection.h:1599
BijectionIterator< T1, T2 > const_iterator
types for STL compliance
Definition bijection.h:1611
BijectionIterator< T1, T2 > iterator
types for STL compliance
Definition bijection.h:1610
std::size_t size_type
types for STL compliance
Definition bijection.h:1608
The class for generic Hash Tables.
Definition hashTable.h:637
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition types.h:74
Class hash tables iterators.
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
STL namespace.
static INLINE const T & op_second(const T &x)
Returns a reference.
Definition bijection.h:1175
Dummy classes for discriminating scalars and non-scalars operators and -> wihtout any overhead.
Definition bijection.h:1146
static INLINE const T & op_second(const T *x)
Returns a refeence over a pointer.
Definition bijection.h:1153
static constexpr Size default_size
The default number of slots in hashtables.
Definition hashTable.h:101
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:115
std::ostream & operator<<(std::ostream &out, const TiXmlNode &base)
Definition tinyxml.cpp:1516