[/ Copyright 2018 Glen Joseph Fernandes (glenjofe@gmail.com) Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). ] [section:detected_or detected_or] template class Op, class... Args> using detected_or = __below; template class Op, class... Args> using detected_or_t = typename detected_or::type; __alias An unspecified type with two public member type definitions: * `value_t` is __true_type if `Op` is a valid template-id, otherwise __false_type * `type` is `Op` if it is a valid template-id, otherwise `Default` __std_paper [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4502.pdf N4502] __compat Requires C++11 variadic templates and C++11 template aliases. __header `#include ` __examples Suppose we wish to declare a type that represents the difference between two values of type T, it should be T::difference_type if such a type exists, or std::ptrdiff_t otherwise: template using difference_t = typename T::difference_type; template using difference_type = boost::detected_or_t; Now the type `difference_type` gives us what we need. See also: __is_detected, __is_detected_convertible, __is_detected_exact. [endsect]