From 0014f5ba2947448703c9ba0afb1c9f1084f1fc50 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 1 Nov 2019 14:48:06 -0700 Subject: uhd: dict: Add typecast operator to std::map<> This will now allow calls like this: uhd::dict d = /* ... */; auto m = static_cast>(d); --- host/tests/dict_test.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'host/tests/dict_test.cpp') diff --git a/host/tests/dict_test.cpp b/host/tests/dict_test.cpp index 99fc2366c..011ea449c 100644 --- a/host/tests/dict_test.cpp +++ b/host/tests/dict_test.cpp @@ -8,6 +8,7 @@ #include #include #include +#include BOOST_AUTO_TEST_CASE(test_dict_init) { @@ -41,6 +42,9 @@ BOOST_AUTO_TEST_CASE(test_const_dict) BOOST_CHECK(d.vals()[1] == 4); BOOST_CHECK_EQUAL(d[-1], 3); BOOST_CHECK_THROW(d[2], std::exception); + + std::map m = static_cast>(d); + BOOST_CHECK_EQUAL(m[-1], 3); } BOOST_AUTO_TEST_CASE(test_dict_pop) -- cgit v1.2.3