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)
174 Container<Type>*
p =
new Container<Type>(input.size());
176 std::copy(input.cbegin(), input.cend(),
p->begin());
191 tmpNrc<Container<Type>>(),
194 if (std::is_same<Type, InputType>::value)
196 this->
cref(
reinterpret_cast<const FieldType&
>(input));
200 this->copyInput(input);
210 const FieldType& store = this->
cref();
211 ref_.resize(store.size());
212 std::copy(store.cbegin(), store.cend(), ref_.begin());