CppWAMP
C++11 client library for the WAMP protocol
|
Go to the documentation of this file.
7 #ifndef CPPWAMP_TYPES_UNORDEREDSET_HPP
8 #define CPPWAMP_TYPES_UNORDEREDSET_HPP
16 #include <unordered_set>
18 #include "../error.hpp"
19 #include "../variant.hpp"
31 const auto& variant = conv.
variant();
32 if (!variant.is<
Array>())
35 "to std::unordered_set");
38 std::unordered_set<T> newSet;
40 for (Array::size_type i=0; i<
array.size(); ++i)
44 newSet.emplace(
array[i].to<T>());
48 std::string msg = e.what();
49 msg +=
" (for element #" + std::to_string(i) +
")";
53 set = std::move(newSet);
64 for (
const auto& elem: set)
73 #endif // CPPWAMP_TYPES_UNORDEREDSET_HPP
const Variant & variant() const
Returns a constant reference to the wrapped variant.
Definition: variant.hpp:1384
@ array
For Variant::Array.
Variant & variant()
Returns a reference to the wrapped variant.
Definition: variant.hpp:1208
Definition: anyhandler.hpp:36
Wrapper around a destination Variant, used for conversions.
Definition: variant.hpp:604
std::vector< Variant > Array
Variant bound type for arrays of variants.
Definition: variantdefs.hpp:51
Wrapper around a source Variant, used for conversions.
Definition: variant.hpp:650
void convert(TConverter &c, TValue &val)
General function for converting custom types to/from Variant.
Definition: variant.hpp:709
Exception type thrown when converting a Variant to an invalid type.
Definition: error.hpp:106
static Variant from(TValue &&value)
Constructs a variant from a custom type.
Definition: variant.hpp:744