unpack_uncallable.cpp 680 B

123456789101112131415161718192021222324
  1. /*=============================================================================
  2. Copyright (c) 2017 Paul Fultz II
  3. unpack_uncallable.cpp
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ==============================================================================*/
  7. #include <boost/hof/unpack.hpp>
  8. struct foo
  9. {};
  10. namespace boost { namespace hof {
  11. template<>
  12. struct unpack_sequence<foo>
  13. {
  14. template<class F, class S>
  15. constexpr static auto apply(F&&, S&& s) BOOST_HOF_RETURNS(s.bar);
  16. };
  17. }
  18. int main() {
  19. boost::hof::unpack(boost::hof::always(1))(foo{});
  20. }