|
|
|||
File indexing completed on 2025-12-15 09:53:03
0001 /*! 0002 @file 0003 Forward declares `boost::hana::div`. 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_DIV_HPP 0011 #define BOOST_HANA_FWD_DIV_HPP 0012 0013 #include <boost/hana/config.hpp> 0014 #include <boost/hana/core/when.hpp> 0015 0016 0017 namespace boost { namespace hana { 0018 //! Generalized integer division. 0019 //! @ingroup group-EuclideanRing 0020 //! 0021 //! 0022 //! Cross-type version of the method 0023 //! -------------------------------- 0024 //! The `div` method is "overloaded" to handle distinct data types 0025 //! with certain properties. Specifically, `div` is defined for 0026 //! _distinct_ data types `A` and `B` such that 0027 //! 1. `A` and `B` share a common data type `C`, as determined by the 0028 //! `common` metafunction 0029 //! 2. `A`, `B` and `C` are all `EuclideanRing`s when taken individually 0030 //! 3. `to<C> : A -> B` and `to<C> : B -> C` are `Ring`-embeddings, as 0031 //! determined by the `is_embedding` metafunction. 0032 //! 0033 //! In that case, the `div` method is defined as 0034 //! @code 0035 //! div(x, y) = div(to<C>(x), to<C>(y)) 0036 //! @endcode 0037 //! 0038 //! 0039 //! Example 0040 //! ------- 0041 //! @include example/div.cpp 0042 #ifdef BOOST_HANA_DOXYGEN_INVOKED 0043 constexpr auto div = [](auto&& x, auto&& y) -> decltype(auto) { 0044 return tag-dispatched; 0045 }; 0046 #else 0047 template <typename T, typename U, typename = void> 0048 struct div_impl : div_impl<T, U, when<true>> { }; 0049 0050 struct div_t { 0051 template <typename X, typename Y> 0052 constexpr decltype(auto) operator()(X&& x, Y&& y) const; 0053 }; 0054 0055 BOOST_HANA_INLINE_VARIABLE constexpr div_t div{}; 0056 #endif 0057 }} // end namespace boost::hana 0058 0059 #endif // !BOOST_HANA_FWD_DIV_HPP
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|