A container for encapsulating key-value pairs. Internally, it maintains a
std::initializer_list<std::pair<const KwargsKey, KwargsValue>>.
template<KwargsKey::value_type... _OptionalList>
class Kwargs;_OptionalListA list of supported keys, constructed using string literals with the_optsuffix.
Tip
The literal suffix name can be customized using the following macros:
KWARGSKEY_LITERAL_SUFFIX_WITHOUT_LEADING_UNDERSCORE:_optKWARGSKEY_LITERAL_SHORT_SUFFIX:_o- Both defined:
o
Warning
If a key that is not in the list is used, or a duplicate key appears, the program will assert() and crash.
If _OptionalList is empty, only key duplication will be checked.
| Name | Description |
|---|---|
Kwargs |
Constructor. |
| Name | Description |
|---|---|
value_type |
Key-value pair type. |
container_type |
Underlying container type. |
iterator |
Iterator type. |
const_iterator |
Iterator type. |
DataItem |
Value wrapper type. |
| Name | Description |
|---|---|
begin |
Returns iterator to the beginning of the key-value pair list. |
end |
Returns iterator to the end of the key-value pair list. |
size |
Returns the number of key-value pairs. |
| Name | Description |
|---|---|
operator[] |
Access the value wrapper corresponding to a key. |
using value_type = std::pair<const KwargsKey, KwargsValue>;
using container_type = std::initializer_list<value_type>;
using iterator = typename container_type::iterator;
using const_iterator = typename container_type::const_iterator;- See struct
DataItem
Constructed with an std::initializer_list<std::pair<const KwargsKey, KwargsValue>>.
constexpr Kwargs(container_type __list) noexcept;Returns a DataItem wrapper for the value associated with the specified key.
constexpr DataItem operator[](KwargsKey __key) noexcept;
template<std::size_t _Size>
constexpr DataItem operator[](const std::array<KwargsKey, _Size>& __options) noexcept;The second overload supports looking up the first matching key when multiple keys are joined using the or operator (via KwargsKey or KwargsKeyLiteral).
Returns an iterator to the beginning of the key-value pair list.
constexpr const_iterator begin() const noexcept;Returns an iterator to the end of the key-value pair list.
constexpr const_iterator end() const noexcept;Returns the number of key-value pairs.
constexpr std::size_t size() const noexcept;