comonad.hpp 995 B

123456789101112131415161718192021222324252627282930313233
  1. /*!
  2. @file
  3. Defines `boost::hana::Comonad`.
  4. @copyright Louis Dionne 2013-2016
  5. Distributed under the Boost Software License, Version 1.0.
  6. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  7. */
  8. #ifndef BOOST_HANA_CONCEPT_COMONAD_HPP
  9. #define BOOST_HANA_CONCEPT_COMONAD_HPP
  10. #include <boost/hana/fwd/concept/comonad.hpp>
  11. #include <boost/hana/config.hpp>
  12. #include <boost/hana/core/default.hpp>
  13. #include <boost/hana/core/tag_of.hpp>
  14. #include <boost/hana/duplicate.hpp>
  15. #include <boost/hana/extend.hpp>
  16. #include <boost/hana/extract.hpp>
  17. BOOST_HANA_NAMESPACE_BEGIN
  18. template <typename W>
  19. struct Comonad {
  20. using Tag = typename tag_of<W>::type;
  21. static constexpr bool value = !is_default<extract_impl<Tag>>::value &&
  22. (!is_default<duplicate_impl<Tag>>::value ||
  23. !is_default<extend_impl<Tag>>::value);
  24. };
  25. BOOST_HANA_NAMESPACE_END
  26. #endif // !BOOST_HANA_CONCEPT_COMONAD_HPP