1 #ifndef MPQC_RANGE_TIE_HPP
2 #define MPQC_RANGE_TIE_HPP
4 #include <boost/array.hpp>
5 #include <boost/tuple/tuple.hpp>
6 #include <boost/tuple/tuple_io.hpp>
8 #include "mpqc/range.hpp"
16 static const int N = boost::tuples::length<Tuple>::value;
17 tie(
const Tuple &s) : Tuple(s) {}
19 operator boost::array<range,N>()
const {
20 boost::array<range,N> a;
25 operator std::vector<range>()
const {
26 boost::array<range,N> a = *
this;
27 return std::vector<range>(a.begin(), a.end());
32 template<
class V,
int I>
33 void cast(V &v, int_<I>)
const {
34 v[I-1] =
range_cast(boost::tuples::get<I-1>(*
this));
39 void cast(V &v, int_<0>)
const {}
43 std::ostream&
operator<<(std::ostream& os,
const range::tie<Tuple> &tie) {
44 os << (
const Tuple&)tie;
56 range::tie<T> range_tie(
const T &t) {
57 return range::tie<T>(t);
63 #endif // MPQC_RANGE_TIE_HPP