tuple.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // (C) Copyright John Maddock 2010.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_MATH_TUPLE_HPP_INCLUDED
  6. # define BOOST_MATH_TUPLE_HPP_INCLUDED
  7. # include <boost/config.hpp>
  8. # include <boost/detail/workaround.hpp>
  9. # include <boost/math/tools/cxx03_warn.hpp>
  10. #if !defined(BOOST_NO_CXX11_HDR_TUPLE) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500)
  11. #include <tuple>
  12. namespace boost{ namespace math{
  13. using ::std::tuple;
  14. // [6.1.3.2] Tuple creation functions
  15. using ::std::ignore;
  16. using ::std::make_tuple;
  17. using ::std::tie;
  18. using ::std::get;
  19. // [6.1.3.3] Tuple helper classes
  20. using ::std::tuple_size;
  21. using ::std::tuple_element;
  22. }}
  23. #elif (defined(__BORLANDC__) && (__BORLANDC__ <= 0x600)) || defined(__IBMCPP__)
  24. #include <boost/tuple/tuple.hpp>
  25. #include <boost/tuple/tuple_comparison.hpp>
  26. #include <boost/type_traits/integral_constant.hpp>
  27. namespace boost{ namespace math{
  28. using ::boost::tuple;
  29. // [6.1.3.2] Tuple creation functions
  30. using ::boost::tuples::ignore;
  31. using ::boost::make_tuple;
  32. using ::boost::tie;
  33. // [6.1.3.3] Tuple helper classes
  34. template <class T>
  35. struct tuple_size
  36. : public ::boost::integral_constant
  37. < ::std::size_t, ::boost::tuples::length<T>::value>
  38. {};
  39. template < int I, class T>
  40. struct tuple_element
  41. {
  42. typedef typename boost::tuples::element<I,T>::type type;
  43. };
  44. #if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
  45. // [6.1.3.4] Element access
  46. using ::boost::get;
  47. #endif
  48. } } // namespaces
  49. #else
  50. #include <boost/fusion/include/tuple.hpp>
  51. #include <boost/fusion/include/std_pair.hpp>
  52. namespace boost{ namespace math{
  53. using ::boost::fusion::tuple;
  54. // [6.1.3.2] Tuple creation functions
  55. using ::boost::fusion::ignore;
  56. using ::boost::fusion::make_tuple;
  57. using ::boost::fusion::tie;
  58. using ::boost::fusion::get;
  59. // [6.1.3.3] Tuple helper classes
  60. using ::boost::fusion::tuple_size;
  61. using ::boost::fusion::tuple_element;
  62. }}
  63. #endif
  64. #endif