Skip to content

Commit f566757

Browse files
committed
Headers: Add full implementation of enable_if
1 parent a5e8bc4 commit f566757

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

headers/type_traits

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,15 @@ template<class T>
368368
using decay_t = T; // SIMPLIFIED typedef
369369
#endif
370370

371-
template<bool, class T = void> struct enable_if {
372-
typedef int type; // SIMPLIFIED type
371+
template<bool, class T = void> struct enable_if {};
372+
373+
template<class T>
374+
struct enable_if<true, T> {
375+
typedef T type;
373376
};
374377
#if CPPREFERENCE_STDVER >= 2014
375-
template<bool, class T = void>
376-
using enable_if_t = int; // SIMPLIFIED typedef
378+
template<bool B, class T = void>
379+
using enable_if_t = typename enable_if<B, T>::type;
377380
#endif
378381

379382
template<bool, class T, class F> struct conditional {

0 commit comments

Comments
 (0)