detector.hpp 915 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. Copyright 2017-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. #ifndef BOOST_TT_DETAIL_DETECTOR_HPP_INCLUDED
  9. #define BOOST_TT_DETAIL_DETECTOR_HPP_INCLUDED
  10. #include <boost/type_traits/integral_constant.hpp>
  11. #include <boost/type_traits/make_void.hpp>
  12. namespace boost {
  13. namespace detail {
  14. template<class T>
  15. using detector_t = typename boost::make_void<T>::type;
  16. template<class Default, class, template<class...> class, class...>
  17. struct detector {
  18. using value_t = boost::false_type;
  19. using type = Default;
  20. };
  21. template<class Default, template<class...> class Op, class... Args>
  22. struct detector<Default, detector_t<Op<Args...> >, Op, Args...> {
  23. using value_t = boost::true_type;
  24. using type = Op<Args...>;
  25. };
  26. } /* detail */
  27. } /* boost */
  28. #endif