rocPRIM
key_value_pair.hpp
1 // Copyright (c) 2017-2023 Advanced Micro Devices, Inc. All rights reserved.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 // THE SOFTWARE.
20 
21 #ifndef ROCPRIM_TYPES_KEY_VALUE_PAIR_HPP_
22 #define ROCPRIM_TYPES_KEY_VALUE_PAIR_HPP_
23 
24 #include "../config.hpp"
25 
28 
29 BEGIN_ROCPRIM_NAMESPACE
30 
32 template<
33  class Key_,
34  class Value_
35 >
37 {
38  #ifndef DOXYGEN_SHOULD_SKIP_THIS
39  using Key = Key_;
40  using Value = Value_;
41  #endif
42 
43  using key_type = Key_;
44  using value_type = Value_;
45 
48 
49  ROCPRIM_HOST_DEVICE inline
50  key_value_pair() = default;
51 
52  ROCPRIM_HOST_DEVICE inline
53  ~key_value_pair() = default;
54 
56  ROCPRIM_HOST_DEVICE inline
57  key_value_pair(const key_type key, const value_type value) : key(key), value(value)
58  {
59  }
60 
63  ROCPRIM_HOST_DEVICE inline
64  bool operator !=(const key_value_pair& kvb)
65  {
66  return (key != kvb.key) || (value != kvb.value);
67  }
68 };
69 
70 END_ROCPRIM_NAMESPACE
71 
73 // end of group utilsmodule
74 
75 #endif // ROCPRIM_TYPES_KEY_VALUE_PAIR_HPP_
Value_ value_type
the value&#39;s type
Definition: key_value_pair.hpp:44
ROCPRIM_HOST_DEVICE bool operator!=(const key_value_pair &kvb)
Returns true if the given key-value pair is not equal to this one.
Definition: key_value_pair.hpp:64
value_type value
the stored value
Definition: key_value_pair.hpp:47
key_type key
the stored key
Definition: key_value_pair.hpp:46
Convenience struct that allows you to store key-value pairs as a composite entity.
Definition: key_value_pair.hpp:36
Key_ key_type
the key&#39;s type
Definition: key_value_pair.hpp:43
ROCPRIM_HOST_DEVICE key_value_pair(const key_type key, const value_type value)
Constructs a key-value pair using the supplied values.
Definition: key_value_pair.hpp:57