Skip to content

Commit 69e2eef

Browse files
committed
simplify trait using concept
1 parent 884b2d3 commit 69e2eef

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

Sofa/framework/Helper/src/sofa/helper/SelectableItem.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,9 @@ class SelectableItem : public BaseSelectableItem
252252
return static_cast<id_type>(-1);
253253
}
254254

255-
template <typename, typename = std::void_t<>>
256-
struct has_deprecation_map : std::false_type {};
257-
258-
// Specialization when T has a static member s_foo
259-
template <typename T>
260-
struct has_deprecation_map<T, std::void_t<decltype(T::s_deprecationMap)>> : std::true_type {};
261-
262255
void keyError(const std::string_view key)
263256
{
264-
if constexpr (has_deprecation_map<Derived>::value)
257+
if constexpr (requires {Derived::s_deprecationMap;})
265258
{
266259
static_assert(std::is_same_v<std::remove_cv_t<decltype(Derived::s_deprecationMap)>, std::map<std::string_view, DeprecatedItem>>);
267260
const auto it = Derived::s_deprecationMap.find(key);

0 commit comments

Comments
 (0)