diff --git a/src/viam/sdk/common/proto_value.cpp b/src/viam/sdk/common/proto_value.cpp index cffca13e1..16443b7f3 100644 --- a/src/viam/sdk/common/proto_value.cpp +++ b/src/viam/sdk/common/proto_value.cpp @@ -76,49 +76,37 @@ bool ProtoValue::is_null() const { } template -std::enable_if_t{}, T&> ProtoValue::get_unchecked() { +T& ProtoValue::get_unchecked() & { assert(this->is_a()); return *(this->self_.template get()); } -template -std::enable_if_t{}, T> ProtoValue::get_unchecked() const { - assert(this->is_a()); - return *(this->self_.template get()); -} - -template bool& ProtoValue::get_unchecked(); -template double& ProtoValue::get_unchecked(); - -template bool ProtoValue::get_unchecked() const; -template double ProtoValue::get_unchecked() const; +template bool& ProtoValue::get_unchecked() &; +template double& ProtoValue::get_unchecked() &; +template std::string& ProtoValue::get_unchecked() &; +template ProtoList& ProtoValue::get_unchecked() &; +template ProtoStruct& ProtoValue::get_unchecked() &; template -std::enable_if_t{}, T&> ProtoValue::get_unchecked() & { +const T& ProtoValue::get_unchecked() const& { assert(this->is_a()); return *(this->self_.template get()); } -template -std::enable_if_t{}, T const&> ProtoValue::get_unchecked() const& { - assert(this->is_a()); - return *(this->self_.template get()); -} +template const bool& ProtoValue::get_unchecked() const&; +template const double& ProtoValue::get_unchecked() const&; +template std::string const& ProtoValue::get_unchecked() const&; +template ProtoList const& ProtoValue::get_unchecked() const&; +template ProtoStruct const& ProtoValue::get_unchecked() const&; template -std::enable_if_t{}, T&&> ProtoValue::get_unchecked() && { +T&& ProtoValue::get_unchecked() && { assert(this->is_a()); return std::move(*(this->self_.template get())); } -template std::string& ProtoValue::get_unchecked() &; -template ProtoList& ProtoValue::get_unchecked() &; -template ProtoStruct& ProtoValue::get_unchecked() &; - -template std::string const& ProtoValue::get_unchecked() const&; -template ProtoList const& ProtoValue::get_unchecked() const&; -template ProtoStruct const& ProtoValue::get_unchecked() const&; - +template bool&& ProtoValue::get_unchecked() &&; +template double&& ProtoValue::get_unchecked() &&; template std::string&& ProtoValue::get_unchecked() &&; template ProtoList&& ProtoValue::get_unchecked() &&; template ProtoStruct&& ProtoValue::get_unchecked() &&; diff --git a/src/viam/sdk/common/proto_value.hpp b/src/viam/sdk/common/proto_value.hpp index 9c9708bd0..3c72d99e2 100644 --- a/src/viam/sdk/common/proto_value.hpp +++ b/src/viam/sdk/common/proto_value.hpp @@ -136,29 +136,16 @@ class ProtoValue { T const* get() const; /// @brief Return a reference to the underlying T, without checking. - /// @tparam T a bool or double template - std::enable_if_t{}, T&> get_unchecked(); - - /// @brief Return the underlying T by value, without checking. - /// @tparam T a bool or double. - template - std::enable_if_t{}, T> get_unchecked() const; - - /// @brief Return a mutable reference to the underlying T, without checking - /// @tparam T a std::string, ProtoList, or ProtoStruct. - template - std::enable_if_t{}, T&> get_unchecked() &; + T& get_unchecked() &; /// @brief Return an immutable reference to the underlying T, without checking. - /// @tparam T a std::string, ProtoList, or ProtoStruct. template - std::enable_if_t{}, T const&> get_unchecked() const&; + const T& get_unchecked() const&; /// @brief Return an rvalue reference to the underlying T, without checking. - /// @tparam T a std::string, ProtoList, or ProtoStruct. template - std::enable_if_t{}, T&&> get_unchecked() &&; + T&& get_unchecked() &&; ///@} @@ -295,22 +282,21 @@ extern template ProtoValue::ProtoValue(ProtoList) noexcept( extern template ProtoValue::ProtoValue(ProtoStruct m) noexcept( std::is_nothrow_move_constructible{}); -// -- Template specialization declarations of get_unchecked: POD types -- // -extern template bool& ProtoValue::get_unchecked(); -extern template double& ProtoValue::get_unchecked(); - -extern template bool ProtoValue::get_unchecked() const; -extern template double ProtoValue::get_unchecked() const; - -// -- Template specialization declarations of get_unchecked: string and recursive types -- // +// -- Template specialization declarations of get_unchecked -- // +extern template bool& ProtoValue::get_unchecked() &; +extern template double& ProtoValue::get_unchecked() &; extern template std::string& ProtoValue::get_unchecked() &; extern template ProtoList& ProtoValue::get_unchecked() &; extern template ProtoStruct& ProtoValue::get_unchecked() &; +extern template bool const& ProtoValue::get_unchecked() const&; +extern template double const& ProtoValue::get_unchecked() const&; extern template std::string const& ProtoValue::get_unchecked() const&; extern template ProtoList const& ProtoValue::get_unchecked() const&; extern template ProtoStruct const& ProtoValue::get_unchecked() const&; +extern template bool&& ProtoValue::get_unchecked() &&; +extern template double&& ProtoValue::get_unchecked() &&; extern template std::string&& ProtoValue::get_unchecked() &&; extern template ProtoList&& ProtoValue::get_unchecked() &&; extern template ProtoStruct&& ProtoValue::get_unchecked() &&;