mirror of
https://github.com/oxen-io/oxen-mq.git
synced 2023-12-13 21:00:31 +01:00
Add C string bt_value ctor
This commit is contained in:
parent
8c28c52d41
commit
9467c4682c
2 changed files with 4 additions and 0 deletions
|
@ -106,6 +106,7 @@ struct bt_value : bt_variant {
|
|||
template <typename T, typename U = std::remove_reference_t<T>, std::enable_if_t<!std::is_integral_v<U> && !detail::is_tuple<U>, int> = 0>
|
||||
bt_value(T&& v) : bt_variant{std::forward<T>(v)} {}
|
||||
|
||||
bt_value(const char* s) : bt_value{std::string_view{s}} {}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -90,6 +90,9 @@ TEST_CASE("bt_value serialization", "[bt][serialization][bt_value]") {
|
|||
std::string x_ = bt_serialize(dna);
|
||||
REQUIRE( bt_serialize(dna) == "i42e" );
|
||||
|
||||
bt_value foo{"foo"};
|
||||
REQUIRE( bt_serialize(foo) == "3:foo" );
|
||||
|
||||
bt_value ibig{-8'000'000'000'000'000'000LL};
|
||||
bt_value ubig{10'000'000'000'000'000'000ULL};
|
||||
int16_t ismall = -123;
|
||||
|
|
Loading…
Reference in a new issue