Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // in C++03:
- // typedef /* compute */ result;
- using result = and_<is_integral<T>, not_<is_char<T>>>;
- // Enforce precondition: every type T must be integral
- static_assert( and_<std::is_integral<T>...>::value, "Violation" );
- template <typename T,
- EnableIf<is_scalable<T>, is_something_else<T>>...>
- T twice(T t) { return 2*t; }
- template<typename T>
- typename enable_if<
- and_<is_scalable<T>, is_something_else<T>>
- , T
- >::type twice(T t) { return 2*t; }
- template<typename T>
- typename std::enable_if<
- is_scalable<T>::value && is_something_else<T>::value
- , T
- >::type twice(T t) { return 2*t; }
- // EnableIf alias now accepts non-type template parameters
- template<typename T
- , EnableIf<is_scalable<T>() && is_something_else<T>()>...>
- T twice(T t) { return 2*t; }
- is_integral<T>::value && !is_char<T>::value
- template<typename T>
- struct is_integral_and_not_char {
- static const bool value = is_integral<T>::value && !is_char<T>::value;
- };
- is_integral_and_not_char<T>::value
- template<typename T>
- struct is_integral_and_not_char
- : std::integral_constant<bool, std::is_integral<T>::value && !std::is_char<T>::value>
- {}
Add Comment
Please, Sign In to add comment