is_detected_convertible.qbk 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. [/
  2. Copyright 2018 Glen Joseph Fernandes
  3. (glenjofe@gmail.com)
  4. Distributed under the Boost Software License,
  5. Version 1.0. (See accompanying file LICENSE_1_0.txt
  6. or copy at http://www.boost.org/LICENSE_1_0.txt).
  7. ]
  8. [section:is_detected_convertible is_detected_convertible]
  9. template<class To, template<class...> class Op, class... Args>
  10. using is_detected_convertible = is_convertible<detected_t<Op, Args...>, To>;
  11. template<class To, template<class...> class Op, class... Args>
  12. constexpr bool is_detected_convertible_v = is_detected_convertible<Op, Args...>::value;
  13. __std_paper [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4502.pdf N4502]
  14. __compat Requires C++11 variadic templates and C++11 template aliases.
  15. __header `#include <boost/type_traits/is_detected_convertible.hpp>`
  16. The type `is_detected_convertible<To, Op, Args>` is an alias for __true_type if the result of
  17. `Op<Args>` is convertible to type `To`. Otherwise it's the type __false_type;
  18. __examples
  19. template<class T>
  20. using size_type_t = typename T::size_type;
  21. static_assert(boost::is_detected_convertible_v<std::size_t, size_type_t, T>);
  22. See also: __is_detected, __is_detected_exact.
  23. [endsect]