26 #ifndef TILEDARRAY_TILE_INTERFACE_SHIFT_H__INCLUDED
27 #define TILEDARRAY_TILE_INTERFACE_SHIFT_H__INCLUDED
29 #include "../type_traits.h"
41 template <
typename Arg,
typename Index,
42 typename = std::enable_if_t<detail::is_integral_range_v<Index>>>
43 inline auto shift(
const Arg& arg,
const Index& range_shift) {
44 return arg.shift(range_shift);
54 template <
typename Arg,
typename Index,
55 typename = std::enable_if_t<std::is_integral_v<Index>>>
56 inline auto shift(
const Arg& arg,
57 const std::initializer_list<Index>& range_shift) {
58 return arg.shift(range_shift);
68 template <
typename Arg,
typename Index,
69 typename = std::enable_if_t<detail::is_integral_range_v<Index>>>
70 inline auto shift_to(Arg& arg,
const Index& range_shift) {
71 return arg.shift_to(range_shift);
81 template <
typename Arg,
typename Index,
82 typename = std::enable_if_t<std::is_integral_v<Index>>>
84 const std::initializer_list<Index>& range_shift) {
85 return arg.shift_to(range_shift);
88 namespace tile_interface {
95 shift(std::declval<T>(), std::declval<std::vector<long>>()))>::type;
99 shift_to(std::declval<T>(), std::declval<std::vector<long>>()))>::type;
101 template <
typename Result,
typename Arg,
typename Enabler =
void>
107 template <
typename Index>
109 const Index& range_shift)
const {
110 return shift(arg, range_shift);
114 template <
typename Result,
typename Arg>
116 typename std::enable_if<
117 !std::is_same<Result, result_of_shift_t<Arg>>::value>::type>
126 template <
typename Index>
128 const Index& range_shift)
const {
129 return Cast_::operator()(
shift(arg, range_shift));
133 template <
typename Result,
typename Arg,
typename Enabler =
void>
139 template <
typename Index>
145 template <
typename Result,
typename Arg>
147 typename std::enable_if<!std::is_same<
148 Result, result_of_shift_to_t<Arg>>::value>::type>
157 template <
typename Index>
159 return Cast_::operator()(
shift_to(arg, range_shift));
163 template <
typename Arg,
typename Enabler =
void>
168 template <
typename Arg>
169 struct shift_trait<Arg, typename std::enable_if<TiledArray::detail::is_type<
170 result_of_shift_t<Arg>>::value>
::type> {
182 template <
typename Result,
typename Arg>
191 template <
typename Result,
typename Arg>
196 #endif // TILEDARRAY_TILE_INTERFACE_SHIFT_H__INCLUDED