@@ -184,13 +184,11 @@ struct DerivedBuilder : public Builder<Base, Args...>
184184 Base* create (Args... ctorArgs) override { return Allocator<Base, T>()(std::forward<Args>(ctorArgs)...); }
185185};
186186
187- template <class T, class U>
188- struct is_tuple_constructible : public std::false_type
189- {};
187+ template <class, class>
188+ inline constexpr bool is_tuple_constructible_v = false ;
190189
191190template <class T, class... Args>
192- struct is_tuple_constructible<T, std::tuple<Args...>> : public std::is_constructible<T, Args...>
193- {};
191+ inline constexpr bool is_tuple_constructible_v<T, std::tuple<Args...>> = std::is_constructible_v<T, Args...>;
194192
195193struct BuilderDatabase
196194{
@@ -230,22 +228,22 @@ template <class NewCtor, class OldCtor>
230228struct ExtendedCtor
231229{
232230 template <class T>
233- using is_constructible = typename NewCtor::template is_constructible <T>;
231+ static constexpr bool is_constructible_v = NewCtor::template is_constructible_v <T>;
234232
235233 /* *
236234 The derived Ctor can "block" the more abstract Ctor, meaning an object
237235 should only be instantiated as the most derived type. enable_if here
238236 checks if both the derived API and the parent API are still valid
239237 */
240238 template <class T>
241- static typename std::enable_if <OldCtor::template is_constructible <T>::value , bool >::type add ()
239+ static std::enable_if_t <OldCtor::template is_constructible_v <T>, bool > add ()
242240 {
243241 // if abstract, force an allocation to generate meaningful errors
244242 return NewCtor::template add<T>() && OldCtor::template add<T>();
245243 }
246244
247245 template <class T>
248- static typename std::enable_if <!OldCtor::template is_constructible <T>::value , bool >::type add ()
246+ static std::enable_if_t <!OldCtor::template is_constructible_v <T>, bool > add ()
249247 {
250248 // if abstract, force an allocation to generate meaningful errors
251249 return NewCtor::template add<T>();
@@ -262,7 +260,7 @@ template <class Base, class... Args>
262260struct SingleCtor
263261{
264262 template <class T>
265- using is_constructible = std::is_constructible <T, Args...>;
263+ static constexpr bool is_constructible_v = std::is_constructible_v <T, Args...>;
266264
267265 template <class T>
268266 static bool add ()
@@ -283,15 +281,12 @@ template <class Base, class Ctor, class... Ctors>
283281struct CtorList : public CtorList<Base, Ctors...>
284282{
285283 template <class T> // if T is constructible with Ctor arguments
286- using is_constructible = typename std::conditional<
287- is_tuple_constructible<T, Ctor>::value,
288- std::true_type, // yes, constructible
289- typename CtorList<Base, Ctors...>::template is_constructible<T> // not constructible here but maybe later
290- >::type;
284+ static constexpr bool is_constructible_v =
285+ is_tuple_constructible_v<T, Ctor> // yes, constructible
286+ || CtorList<Base, Ctors...>::template is_constructible_v<T>; // not constructible here but maybe later
291287
292288 template <class T, int NumValid = 0 , class U = T>
293- static typename std::enable_if<std::is_abstract<U>::value || is_tuple_constructible<U, Ctor>::value, bool >::type
294- add ()
289+ static std::enable_if_t <std::is_abstract_v<U> || is_tuple_constructible_v<U, Ctor>, bool > add ()
295290 {
296291 // if abstract, force an allocation to generate meaningful errors
297292 auto * fact = ElementsBuilder<Base, Ctor>::template makeBuilder<U>();
@@ -300,8 +295,7 @@ struct CtorList : public CtorList<Base, Ctors...>
300295 }
301296
302297 template <class T, int NumValid = 0 , class U = T>
303- static typename std::enable_if<!std::is_abstract<U>::value && !is_tuple_constructible<U, Ctor>::value, bool >::type
304- add ()
298+ static std::enable_if_t <!std::is_abstract_v<U> && !is_tuple_constructible_v<U, Ctor>, bool > add ()
305299 {
306300 return CtorList<Base, Ctors...>::template add<T, NumValid>();
307301 }
@@ -323,8 +317,8 @@ class NoValidConstructorsForDerivedType<0>
323317template <class Base>
324318struct CtorList<Base, void >
325319{
326- template <class T >
327- using is_constructible = std::false_type ;
320+ template <class>
321+ static constexpr bool is_constructible_v = false ;
328322
329323 template <class T, int numValidCtors>
330324 static bool add ()
0 commit comments