38 #ifndef PrecisionAdaptor_H
39 #define PrecisionAdaptor_H
50 template<
class Type,
class InputType,
template<
class>
class Container =
Field>
53 public tmpNrc<Container<Type>>
58 void copyInput(
const Container<InputType>& input)
62 Container<Type>*
p =
new Container<Type>(input.size());
64 std::copy(input.cbegin(), input.cend(),
p->begin());
68 void moveInput(
tmp<Container<InputType>>& input)
70 if (std::is_same<Type, InputType>::value)
77 this->
reset(tinput.ptr());
81 this->
cref(tinput.cref());
86 this->copyInput(input());
105 if (std::is_same<Type, InputType>::value)
107 this->
cref(
reinterpret_cast<const FieldType&
>(input));
111 this->copyInput(input);
121 this->moveInput(input);
137 static const Container<Type>&
get
139 const Container<InputType>& input,
143 if (std::is_same<Type, InputType>::value)
145 return reinterpret_cast<const FieldType&
>(input);
149 dst.resize(input.size());
150 std::copy(input.cbegin(), input.cend(), dst.begin());
158 template<
class Type,
class InputType,
template<
class>
class Container =
Field>
161 public tmpNrc<Container<Type>>
166 Container<InputType>& ref_;
172 void copyInput(
const Container<InputType>& input,
const bool copy)
174 Container<Type>*
p =
new Container<Type>(input.size());
178 std::copy(input.cbegin(), input.cend(),
p->begin());
194 tmpNrc<Container<Type>>(),
197 if (std::is_same<Type, InputType>::value)
199 this->
cref(
reinterpret_cast<const FieldType&
>(input));
203 this->copyInput(input, copy);
213 const FieldType& store = this->
cref();
214 ref_.resize(store.size());
215 std::copy(store.cbegin(), store.cend(), ref_.begin());