From 7c455c7f231157d1aa515e1e390f66bbbc22dafe Mon Sep 17 00:00:00 2001 From: Anton Pankratov Date: Thu, 10 Feb 2022 18:53:21 +0300 Subject: [PATCH] Removed ov::Any rvalue cast (#10267) --- src/core/include/openvino/core/any.hpp | 100 ------------------------- 1 file changed, 100 deletions(-) diff --git a/src/core/include/openvino/core/any.hpp b/src/core/include/openvino/core/any.hpp index 2e094c44f2d..e2e1160b63c 100644 --- a/src/core/include/openvino/core/any.hpp +++ b/src/core/include/openvino/core/any.hpp @@ -490,41 +490,6 @@ public: return false; } - /** - * Dynamic cast to specified type - * @tparam T type - * @return casted object - */ - template - typename std::enable_if>::value, T>::type&& as() && { - if (_impl == nullptr) { - _temp_impl = std::make_shared>>(T{}); - return _temp_impl->as(); - } else { - if (_impl->is(typeid(decay_t))) { - return std::move(*static_cast*>(_impl->addressof())); - } else { - auto runtime_attribute = _impl->as_runtime_attribute(); - if (runtime_attribute == nullptr) { - throw ov::Exception{ - std::string{"Any does not contains pointer to runtime_attribute. It contains "} + - _impl->type_info().name()}; - } - auto vptr = std::dynamic_pointer_cast(runtime_attribute); - if (vptr == nullptr && T::element_type::get_type_info_static() != runtime_attribute->get_type_info() && - T::element_type::get_type_info_static() != RuntimeAttribute::get_type_info_static()) { - throw ov::Exception{std::string{"Could not cast Any runtime_attribute to "} + typeid(T).name() + - " from " + _impl->type_info().name() + "; from " + - static_cast(runtime_attribute->get_type_info()) + " to " + - static_cast(T::element_type::get_type_info_static())}; - } - vptr = std::static_pointer_cast(runtime_attribute); - _temp_impl = std::make_shared>>(vptr); - return _temp_impl->as(); - } - } - } - /** * Dynamic cast to specified type * @tparam T type @@ -596,27 +561,6 @@ public: } } - /** - * Dynamic cast to specified type - * @tparam T type - * @return casted object - */ - template - typename std::enable_if>::value && - !std::is_same::value && std::is_default_constructible::value, - T>::type&& - as() && { - impl_check(); - if (_impl->is(typeid(std::string))) { - _temp_impl = std::make_shared>>(); - std::stringstream strm{as()}; - _temp_impl->read(strm); - return std::move(*static_cast*>(_temp_impl->addressof())); - } - _impl->type_check(typeid(decay_t)); - return std::move(*static_cast*>(_impl->addressof())); - } - /** * Dynamic cast to specified type * @tparam T type @@ -671,21 +615,6 @@ public: throw ov::Exception{std::string{"Bad cast from: "} + _impl->type_info().name() + " to: " + typeid(T).name()}; } - /** - * Dynamic cast to specified type - * @tparam T type - * @return casted object - */ - template - typename std::enable_if>::value && - !std::is_same::value && !std::is_default_constructible::value, - T>::type&& - as() && { - impl_check(); - _impl->type_check(typeid(decay_t)); - return std::move(*static_cast*>(_impl->addressof())); - } - /** * Dynamic cast to specified type * @tparam T type @@ -730,24 +659,6 @@ public: throw ov::Exception{std::string{"Bad cast from: "} + _impl->type_info().name() + " to: " + typeid(T).name()}; } - /** - * Dynamic cast to specified type - * @tparam T type - * @return casted object - */ - template - typename std::enable_if::value, T>::type&& as() && { - impl_check(); - if (_impl->is(typeid(decay_t))) { - return std::move(*static_cast*>(_impl->addressof())); - } else { - std::stringstream strm; - print(strm); - _str = strm.str(); - return std::move(_str); - } - } - /** * Dynamic cast to specified type * @tparam T type @@ -817,17 +728,6 @@ public: return const_cast(this)->as(); } - /** - * @brief Converts to specified type - * @tparam T type - * @return casted object - */ - template - OPENVINO_DEPRECATED("Please use as() method") - operator T &&() && { - return std::move(as()); - } - /** * @brief The comparison operator for the Any *