3
3
#include < algorithm>
4
4
#include < cstddef>
5
5
#include < ostream>
6
+ #include < set>
6
7
#include < string>
7
- #include < unordered_set>
8
8
#include < vector>
9
9
10
10
#include < boost/container_hash/hash.hpp>
@@ -33,18 +33,7 @@ namespace launchdarkly {
33
33
*/
34
34
class AttributeReference {
35
35
public:
36
- /* *
37
- * Provides a hashing function for use with unordered sets.
38
- */
39
- struct HashFunction {
40
- std::size_t operator ()(AttributeReference const & ref) const {
41
- return boost::hash_range (ref.components_ .begin (),
42
- ref.components_ .end ());
43
- }
44
- };
45
-
46
- using SetType = std::unordered_set<AttributeReference,
47
- AttributeReference::HashFunction>;
36
+ using SetType = std::set<AttributeReference>;
48
37
49
38
/* *
50
39
* Get the component of the attribute reference at the specified depth.
@@ -56,36 +45,36 @@ class AttributeReference {
56
45
* @return The component at the specified depth or an empty string if the
57
46
* depth is out of bounds.
58
47
*/
59
- std::string const & component (std::size_t depth) const ;
48
+ [[nodiscard]] std::string const & component (std::size_t depth) const ;
60
49
61
50
/* *
62
51
* Get the total depth of the reference.
63
52
*
64
53
* For example, depth() on the reference `/a/b/c` would return 3.
65
54
* @return
66
55
*/
67
- std::size_t depth () const ;
56
+ [[nodiscard]] std::size_t depth () const ;
68
57
69
58
/* *
70
59
* Check if the reference is a "kind" reference. Either `/kind` or `kind`.
71
60
*
72
61
* @return True if it is a kind reference.
73
62
*/
74
- bool is_kind () const ;
63
+ [[nodiscard]] bool is_kind () const ;
75
64
76
65
/* * Check if the reference is valid.
77
66
*
78
67
* @return True if the reference is valid.
79
68
*/
80
- bool valid () const ;
69
+ [[nodiscard]] bool valid () const ;
81
70
82
71
/* *
83
72
* The redaction name will always be an attribute reference compatible
84
73
* string. So, for instance, a literal that contained `/attr` would be
85
74
* converted to `/~1attr`.
86
75
* @return String to use in redacted attributes.
87
76
*/
88
- std::string const & redaction_name () const ;
77
+ [[nodiscard]] std::string const & redaction_name () const ;
89
78
90
79
/* *
91
80
* Create an attribute from a string that is known to be an attribute
0 commit comments