1 /*! 2 @file 3 Forward declares `boost::hana::one`. 4 5 @copyright Louis Dionne 2013-2017 6 Distributed under the Boost Software License, Version 1.0. 7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 8 */ 9 10 #ifndef BOOST_HANA_FWD_ONE_HPP 11 #define BOOST_HANA_FWD_ONE_HPP 12 13 #include <boost/hana/config.hpp> 14 #include <boost/hana/core/when.hpp> 15 16 17 BOOST_HANA_NAMESPACE_BEGIN 18 //! Identity of the `Ring` multiplication. 19 //! @ingroup group-Ring 20 //! 21 //! @tparam R 22 //! The tag (must be a model of `Ring`) of the returned identity. 23 //! 24 //! 25 //! Example 26 //! ------- 27 //! @include example/one.cpp 28 #ifdef BOOST_HANA_DOXYGEN_INVOKED 29 template <typename R> 30 constexpr auto one = []() -> decltype(auto) { 31 return tag-dispatched; 32 }; 33 #else 34 template <typename R, typename = void> 35 struct one_impl : one_impl<R, when<true>> { }; 36 37 template <typename R> 38 struct one_t { 39 constexpr decltype(auto) operator()() const; 40 }; 41 42 template <typename R> 43 constexpr one_t<R> one{}; 44 #endif 45 BOOST_HANA_NAMESPACE_END 46 47 #endif // !BOOST_HANA_FWD_ONE_HPP 48