1 /*! 2 @file 3 Forward declares `boost::hana::min`. 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_MIN_HPP 11 #define BOOST_HANA_FWD_MIN_HPP 12 13 #include <boost/hana/config.hpp> 14 #include <boost/hana/core/when.hpp> 15 16 17 BOOST_HANA_NAMESPACE_BEGIN 18 //! Returns the smallest of its arguments according to the `less` ordering. 19 //! @ingroup group-Orderable 20 //! 21 //! 22 //! @todo 23 //! We can't specify the signature right now, because the tag of the 24 //! returned object depends on whether `x < y` or not. If we wanted to be 25 //! mathematically correct, we should probably ask that `if_(cond, x, y)` 26 //! returns a common data type of `x` and `y`, and then the behavior 27 //! of `min` would follow naturally. However, I'm unsure whether this 28 //! is desirable because that's a big requirement. 29 //! 30 //! 31 //! Example 32 //! ------- 33 //! @include example/min.cpp 34 #ifdef BOOST_HANA_DOXYGEN_INVOKED 35 constexpr auto min = [](auto&& x, auto&& y) -> decltype(auto) { 36 return tag-dispatched; 37 }; 38 #else 39 template <typename T, typename U, typename = void> 40 struct min_impl : min_impl<T, U, when<true>> { }; 41 42 struct min_t { 43 template <typename X, typename Y> 44 constexpr decltype(auto) operator()(X&& x, Y&& y) const; 45 }; 46 47 constexpr min_t min{}; 48 #endif 49 BOOST_HANA_NAMESPACE_END 50 51 #endif // !BOOST_HANA_FWD_MIN_HPP 52