@@ -136,7 +136,7 @@ namespace gt_verification {
136136 static_assert (
137137 std::is_same< typename FieldType::storage_t ::data_t , T >::value, " internal error: types do not match" );
138138
139- type_erased_field_view_base (FieldType & field) : field_(field) {}
139+ type_erased_field_view_base (FieldType field) : field_(field) {}
140140
141141 virtual const T &access (int i, int j, int k) const noexcept override {
142142 return make_host_view (field_)(i, j, k);
@@ -189,7 +189,7 @@ namespace gt_verification {
189189 virtual void sync () noexcept override { field_.sync (); }
190190
191191 private:
192- FieldType & field_;
192+ FieldType field_;
193193 };
194194
195195 template < typename FieldType, typename T >
@@ -320,15 +320,15 @@ namespace gt_verification {
320320 * @brief Create a TypeErasedFieldView from GridTools field (stores a reference to the field)
321321 */
322322 template < class FieldType >
323- type_erased_field_view (const FieldType & field) {
323+ type_erased_field_view (FieldType field) {
324324 static_assert (
325325 !internal::is_type_erased_field_view< FieldType >::value, " FieldType is not a GridTools field" );
326326
327327 // The const cast is ugly here but the signature of this constructor needs to be the same as
328328 // the copy constructor. Hence, we need to capture the field by const ref.. maybe this can
329329 // be improved.
330330 base_ = std::make_shared< internal::type_erased_field_view_base< FieldType, T > >(
331- const_cast < FieldType & >( field) );
331+ field);
332332 }
333333
334334 /* *
0 commit comments