Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:39:09

0001 //  (C) Copyright John Maddock 2010.
0002 //  (C) Copyright Matt Borland 2024.
0003 //  Use, modification and distribution are subject to the
0004 //  Boost Software License, Version 1.0. (See accompanying file
0005 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 #ifndef BOOST_MATH_TUPLE_HPP_INCLUDED
0008 #define BOOST_MATH_TUPLE_HPP_INCLUDED
0009 
0010 #include <boost/math/tools/config.hpp>
0011 
0012 #ifdef BOOST_MATH_ENABLE_CUDA
0013 
0014 #include <boost/math/tools/type_traits.hpp>
0015 #include <cuda/std/utility>
0016 #include <cuda/std/tuple>
0017 
0018 namespace boost { 
0019 namespace math {
0020 
0021 using cuda::std::pair;
0022 using cuda::std::tuple;
0023 
0024 using cuda::std::make_pair;
0025 
0026 using cuda::std::tie;
0027 using cuda::std::get;
0028 
0029 using cuda::std::tuple_size;
0030 using cuda::std::tuple_element;
0031 
0032 namespace detail {
0033 
0034 template <typename T>
0035 BOOST_MATH_GPU_ENABLED T&& forward(boost::math::remove_reference_t<T>& arg) noexcept
0036 {
0037     return static_cast<T&&>(arg);
0038 }
0039 
0040 template <typename T>
0041 BOOST_MATH_GPU_ENABLED T&& forward(boost::math::remove_reference_t<T>&& arg) noexcept
0042 {
0043     static_assert(!boost::math::is_lvalue_reference<T>::value, "Cannot forward an rvalue as an lvalue.");
0044     return static_cast<T&&>(arg);
0045 }
0046 
0047 } // namespace detail
0048 
0049 template <typename T, typename... Ts>
0050 BOOST_MATH_GPU_ENABLED auto make_tuple(T&& t, Ts&&... ts) 
0051 {
0052     return cuda::std::tuple<boost::math::decay_t<T>, boost::math::decay_t<Ts>...>(
0053         boost::math::detail::forward<T>(t), boost::math::detail::forward<Ts>(ts)...
0054     );
0055 }
0056 
0057 } // namespace math
0058 } // namespace boost
0059 
0060 #else
0061 
0062 #include <tuple>
0063 
0064 namespace boost { 
0065 namespace math {
0066 
0067 using ::std::tuple;
0068 using ::std::pair;
0069 
0070 // [6.1.3.2] Tuple creation functions
0071 using ::std::ignore;
0072 using ::std::make_tuple;
0073 using ::std::tie;
0074 using ::std::get;
0075 
0076 // [6.1.3.3] Tuple helper classes
0077 using ::std::tuple_size;
0078 using ::std::tuple_element;
0079 
0080 // Pair helpers
0081 using ::std::make_pair;
0082 
0083 } // namespace math
0084 } // namespace boost
0085 
0086 #endif // BOOST_MATH_ENABLE_CUDA
0087 
0088 #endif