Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:53:04

0001 /*!
0002 @file
0003 Forward declares `boost::hana::if_`.
0004 
0005 Copyright Louis Dionne 2013-2022
0006 Distributed under the Boost Software License, Version 1.0.
0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
0008  */
0009 
0010 #ifndef BOOST_HANA_FWD_IF_HPP
0011 #define BOOST_HANA_FWD_IF_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     //! Conditionally return one of two values based on a condition.
0019     //! @ingroup group-Logical
0020     //!
0021     //! Specifically, `then` is returned iff `cond` is true-valued, and
0022     //! `else_` is returned otherwise. Note that some `Logical` models may
0023     //! allow `then` and `else_` to have different types, while others may
0024     //! require both values to have the same type.
0025     //!
0026     //!
0027     //! @param cond
0028     //! The condition determining which of the two values is returned.
0029     //!
0030     //! @param then
0031     //! The value returned when `cond` is true-valued.
0032     //!
0033     //! @param else_
0034     //! The value returned when `cond` is false-valued.
0035     //!
0036     //!
0037     //! Example
0038     //! -------
0039     //! @include example/if.cpp
0040 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0041     constexpr auto if_ = [](auto&& cond, auto&& then, auto&& else_) -> decltype(auto) {
0042         return tag-dispatched;
0043     };
0044 #else
0045     template <typename L, typename = void>
0046     struct if_impl : if_impl<L, when<true>> { };
0047 
0048     struct if_t {
0049         template <typename Cond, typename Then, typename Else>
0050         constexpr decltype(auto) operator()(Cond&& cond, Then&& then, Else&& else_) const;
0051     };
0052 
0053     BOOST_HANA_INLINE_VARIABLE constexpr if_t if_{};
0054 #endif
0055 }} // end namespace boost::hana
0056 
0057 #endif // !BOOST_HANA_FWD_IF_HPP