HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_Bimap.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS: A bi-directional map based on hboost::bimap.
7  *
8  * Example usage:
9  *
10  * const auto theBimap = UT_Bimap<UT_StringHolder, int>({
11  * { "a", 1 },
12  * { "b", 2 },
13  * { "c", 3 }
14  * });
15  *
16  * // If the string that you are searching for is not a UT_StringHolder, use
17  * // UTmakeUnsafeRef.
18  * const auto left_it = theBimap.left.find(UTmakeUnsafeRef("b"));
19  * if (left_it != theBimap.left.end())
20  * UTdebugPrintCd(green, left_it->first, left_it->second);
21  *
22  * const auto right_it = theBimap.right.find(3);
23  * if (right_it != theBimap.right.end())
24  * UTdebugPrintCd(green, right_it->first, right_it->second);
25  */
26 
27 #ifndef __UT_Bimap__
28 #define __UT_Bimap__
29 
30 #include <hboost/bimap.hpp>
31 
32 template<class KeyTypeA, class KeyTypeB>
33 class UT_Bimap : public hboost::bimap<KeyTypeA, KeyTypeB>
34 {
35 public:
36  explicit UT_Bimap(std::initializer_list<typename UT_Bimap<KeyTypeA, KeyTypeB>::value_type> list)
37  : Base(list.begin(), list.end())
38  {
39  }
40 
41  using Base = hboost::bimap<KeyTypeA, KeyTypeB>;
42  using Base::Base;
43 };
44 
45 #endif // __UT_Bimap__
UT_Bimap(std::initializer_list< typename UT_Bimap< KeyTypeA, KeyTypeB >::value_type > list)
Definition: UT_Bimap.h:36
hboost::bimap< KeyTypeA, KeyTypeB > Base
Definition: UT_Bimap.h:41
GLuint GLuint end
Definition: glcorearb.h:475
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.
Definition: node.h:483