From a27af78f75493982fca441ce0df6c5bc6a6d5330 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Thu, 9 Jan 2025 17:11:00 +0100 Subject: [PATCH] [Type] Deprecate is_container trait --- Sofa/framework/Helper/src/sofa/helper/OptionsGroup.h | 9 ++++----- Sofa/framework/Type/src/sofa/type/config.h.in | 9 +++++++++ Sofa/framework/Type/src/sofa/type/trait/is_container.h | 5 +++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Sofa/framework/Helper/src/sofa/helper/OptionsGroup.h b/Sofa/framework/Helper/src/sofa/helper/OptionsGroup.h index a6fa39ac04b..d53707e4e9a 100644 --- a/Sofa/framework/Helper/src/sofa/helper/OptionsGroup.h +++ b/Sofa/framework/Helper/src/sofa/helper/OptionsGroup.h @@ -28,7 +28,6 @@ #include #include -#include namespace sofa::helper { @@ -58,7 +57,7 @@ public : explicit OptionsGroup(int nbofRadioButton,...); ///generic constructor taking other string container like list, set, vector - template ::value> > + template explicit OptionsGroup(const T& list); template OptionsGroup(const std::initializer_list& list); @@ -114,7 +113,7 @@ public : type::vector textItems ; unsigned int selectedItem ; - template void buildFromContainer(const T& list); + template void buildFromContainer(const T& list); public: @@ -137,7 +136,7 @@ inline std::istream & operator >>(std::istream& in, OptionsGroup& m_trick) return in; } -template +template OptionsGroup::OptionsGroup(const T& list) { buildFromContainer(list); @@ -159,7 +158,7 @@ void OptionsGroup::setNames(const std::initializer_list& list) selectedItem=0; } -template +template void OptionsGroup::buildFromContainer(const T& list) { textItems.reserve(list.size()); diff --git a/Sofa/framework/Type/src/sofa/type/config.h.in b/Sofa/framework/Type/src/sofa/type/config.h.in index c4c1194ef7a..2bb528f7e5f 100644 --- a/Sofa/framework/Type/src/sofa/type/config.h.in +++ b/Sofa/framework/Type/src/sofa/type/config.h.in @@ -50,3 +50,12 @@ "v24.12", "v25.06", \ "Use isNegligible instead.") #endif + +#ifdef SOFA_BUILD_SOFA_TYPE +#define SOFA_ATTRIBUTE_DEPRECATED__IS_CONTAINER() +#else +#define SOFA_ATTRIBUTE_DEPRECATED__IS_CONTAINER() \ + SOFA_ATTRIBUTE_DISABLED( \ + "v25.06", "v25.12", \ + "Use std::ranges::ranges concept instead.") +#endif diff --git a/Sofa/framework/Type/src/sofa/type/trait/is_container.h b/Sofa/framework/Type/src/sofa/type/trait/is_container.h index 7ce8867ee55..52537fa767f 100644 --- a/Sofa/framework/Type/src/sofa/type/trait/is_container.h +++ b/Sofa/framework/Type/src/sofa/type/trait/is_container.h @@ -21,12 +21,17 @@ ******************************************************************************/ #pragma once #include +#include + +SOFA_HEADER_DEPRECATED_NOT_REPLACED("v25.06", "v25.12") + namespace sofa::type::trait { /// Detect if a type T has iterator/const iterator function. template +SOFA_ATTRIBUTE_DEPRECATED__IS_CONTAINER() struct is_container { typedef typename std::remove_const::type test_type;