From f1153cd864805ad2ed1197a9667e333dc38b8873 Mon Sep 17 00:00:00 2001 From: David Beck Date: Thu, 11 Oct 2018 15:47:00 +0100 Subject: IVGCVSW-1969 : remove boost::optional compatibility from ArmNN Optional * because it was added by mistake, assuming it was released in 18.08 which is not the case Change-Id: I9c288eba56f3f6192007f79db884b255a14456e4 --- include/armnn/Optional.hpp | 51 ----------------------------------------- src/armnn/test/OptionalTest.cpp | 37 +----------------------------- 2 files changed, 1 insertion(+), 87 deletions(-) diff --git a/include/armnn/Optional.hpp b/include/armnn/Optional.hpp index e55702d915..cfe0d30610 100644 --- a/include/armnn/Optional.hpp +++ b/include/armnn/Optional.hpp @@ -59,28 +59,6 @@ protected: bool m_HasValue; }; -struct HasGetMemberFunction -{ - template - static auto Check(T* p) -> decltype(p->get(), std::true_type()); - - template - static auto Check(...) -> std::false_type; -}; - -// -// Predicate checking for boost::optional compatibility -// -template -struct CheckBoostOptionalSignature -{ - using ResultType = decltype(HasGetMemberFunction::Check(0)); - - static constexpr bool Result() { - return std::is_same::value; - } -}; - // // The default implementation is the non-reference case. This // has an unsigned char array for storing the optional value which @@ -107,16 +85,6 @@ public: *this = other; } - // enable construction from types that matches the CheckBoostOptionalSignature - // predicate - template ::Result()>> - OptionalReferenceSwitch(const O& other) - : Base{} - { - *this = other; - } - OptionalReferenceSwitch& operator=(const T& value) { reset(); @@ -141,21 +109,6 @@ public: return *this; } - // enable copying from types that matches the CheckBoostOptionalSignature - // predicate - template ::Result()>> - OptionalReferenceSwitch& operator=(const O& other) - { - reset(); - if (other) - { - Construct(other.get()); - } - - return *this; - } - ~OptionalReferenceSwitch() { reset(); @@ -294,10 +247,6 @@ public: Optional(EmptyOptional empty) : BaseSwitch{empty} {} Optional(const Optional& other) : BaseSwitch{other} {} Optional(const BaseSwitch& other) : BaseSwitch{other} {} - - template ::Result()>> - Optional(const O& other) : BaseSwitch{other} {} }; } diff --git a/src/armnn/test/OptionalTest.cpp b/src/armnn/test/OptionalTest.cpp index a869c7e191..3f4c02d56f 100644 --- a/src/armnn/test/OptionalTest.cpp +++ b/src/armnn/test/OptionalTest.cpp @@ -5,7 +5,6 @@ #include #include -#include #include namespace @@ -19,19 +18,7 @@ void PassStringRefWithDefault(armnn::Optional value = armnn::Empty { } -void BoostCompatibilityTester(const armnn::Optional& optionalString, - bool hasValue, - const std::string& expectedValue) -{ - BOOST_TEST(optionalString.has_value() == hasValue); - if (hasValue) - { - BOOST_TEST(optionalString.value() == expectedValue); - } -} - -} - +} // namespace BOOST_AUTO_TEST_SUITE(OptionalTests) @@ -105,28 +92,6 @@ BOOST_AUTO_TEST_CASE(StringRefTests) BOOST_TEST(optionalHelloRef3.value() == "Long Other String"); } -BOOST_AUTO_TEST_CASE(BoostCompatibilityTests) -{ - // sanity checks - BoostCompatibilityTester(armnn::Optional(), false, ""); - BoostCompatibilityTester(armnn::Optional("Hello World"), true, "Hello World"); - - // verify boost signature selector - BOOST_TEST(armnn::CheckBoostOptionalSignature>::Result() == true); - BOOST_TEST(armnn::CheckBoostOptionalSignature>::Result() == false); - - // the real thing is to see that we can pass a boost::optional in place - // of an ArmNN Optional - boost::optional empty; - boost::optional helloWorld("Hello World"); - - BoostCompatibilityTester(empty, false, ""); - BoostCompatibilityTester(helloWorld, true, "Hello World"); - - BoostCompatibilityTester(boost::optional(), false, ""); - BoostCompatibilityTester(boost::optional("Hello World"), true, "Hello World"); -} - BOOST_AUTO_TEST_CASE(SimpleIntTests) { const int intValue = 123; -- cgit v1.2.1