3 Forward declares `boost::hana::if_`.
5 @copyright Louis Dionne 2013-2016
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)
10 #ifndef BOOST_HANA_FWD_IF_HPP
11 #define BOOST_HANA_FWD_IF_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Conditionally return one of two values based on a condition.
19 //! @ingroup group-Logical
21 //! Specifically, `then` is returned iff `cond` is true-valued, and
22 //! `else_` is returned otherwise. Note that some `Logical` models may
23 //! allow `then` and `else_` to have different types, while others may
24 //! require both values to have the same type.
28 //! The condition determining which of the two values is returned.
31 //! The value returned when `cond` is true-valued.
34 //! The value returned when `cond` is false-valued.
39 //! @include example/if.cpp
40 #ifdef BOOST_HANA_DOXYGEN_INVOKED
41 constexpr auto if_ = [](auto&& cond, auto&& then, auto&& else_) -> decltype(auto) {
42 return tag-dispatched;
45 template <typename L, typename = void>
46 struct if_impl : if_impl<L, when<true>> { };
49 template <typename Cond, typename Then, typename Else>
50 constexpr decltype(auto) operator()(Cond&& cond, Then&& then, Else&& else_) const;
55 BOOST_HANA_NAMESPACE_END
57 #endif // !BOOST_HANA_FWD_IF_HPP