MPQC  3.0.0-alpha
forward.hpp
1 #ifndef MPQC_MATH_TENSOR_FORWARD_HPP
2 #define MPQC_MATH_TENSOR_FORWARD_HPP
3 
4 #include "mpqc/math/tensor/order.hpp"
5 
6 #include <boost/fusion/include/boost_tuple.hpp>
7 #include <boost/mpl/accumulate.hpp>
8 #include <boost/mpl/print.hpp>
9 
10 #include <boost/type_traits/remove_const.hpp>
11 #include <boost/type_traits/remove_reference.hpp>
12 
13 namespace mpqc {
14 
15  template <typename T, size_t N, class Order = TensorColumnMajor >
16  struct TensorBase;
17 
18 }
19 
20 
21 namespace mpqc {
22 namespace detail {
23 namespace Tensor {
24 
25  template<class T>
26  struct is_integral {
27  typedef typename boost::is_integral<
28  typename boost::remove_reference<T>::type
29  >::type type;
30  };
31 
33  template<class T>
35  static const bool value =
36  boost::mpl::accumulate<
37  T,
38  boost::mpl::bool_<true>,
39  boost::mpl::and_< is_integral<boost::mpl::_2>, boost::mpl::_1 >
40  >::type::value;
41  };
42 
44  template<class Tie>
45  struct integral_tie : Tie {
46  integral_tie(const Tie &t) : Tie(t) {}
47  };
48 
50  template<class Tie>
51  struct range_tie : Tie {
52  range_tie(const Tie &t) : Tie(t) {}
53  };
54 
57  template<class Tie>
58  typename boost::enable_if<
61  >::type
62  tie(const Tie &t) {
63  return integral_tie<Tie>(t);
64  }
65 
68  template<class Tie>
69  typename boost::disable_if<
70  is_integral_tuple<Tie>,
71  range_tie<Tie>
72  >::type
73  tie(const Tie &t) {
74  return range_tie<Tie>(t);
75  }
76 
77 } // Tensor
78 } // detail
79 } // mpqc
80 
81 
82 #endif /* MPQC_MATH_TENSOR_FORWARD_HPP */
mpqc
Contains new MPQC code since version 3.
Definition: integralenginepool.hpp:37
mpqc::detail::Tensor::is_integral_tuple
"returns" true if every element of tuple T is an integral type
Definition: forward.hpp:34
mpqc::detail::Tensor::integral_tie
index tie wrapper
Definition: forward.hpp:45
mpqc::detail::Tensor::range_tie
range tie wrapper
Definition: forward.hpp:51
mpqc::detail::Tensor::is_integral
Definition: forward.hpp:26

Generated at Sun Jan 26 2020 23:24:01 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.