make.hpp 962 B

12345678910111213141516171819202122232425262728293031
  1. /*=============================================================================
  2. Copyright (c) 2015 Paul Fultz II
  3. make.h
  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. #ifndef BOOST_HOF_GUARD_MAKE_H
  8. #define BOOST_HOF_GUARD_MAKE_H
  9. #include <boost/hof/detail/move.hpp>
  10. #include <boost/hof/detail/join.hpp>
  11. #include <boost/hof/detail/delegate.hpp>
  12. namespace boost { namespace hof { namespace detail {
  13. template<template<class...> class Adaptor>
  14. struct make
  15. {
  16. constexpr make() noexcept
  17. {}
  18. template<class... Fs, class Result=BOOST_HOF_JOIN(Adaptor, Fs...)>
  19. constexpr Result operator()(Fs... fs) const BOOST_HOF_NOEXCEPT_CONSTRUCTIBLE(Result, Fs&&...)
  20. {
  21. return Result(static_cast<Fs&&>(fs)...);
  22. }
  23. };
  24. }}} // namespace boost::hof
  25. #endif