File tree 2 files changed +18
-3
lines changed
librapid/include/librapid
2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,8 @@ namespace librapid {
298
298
// / \param value The value to write to the array's storage
299
299
LIBRAPID_ALWAYS_INLINE void write (size_t index, const Scalar &value);
300
300
301
+ LIBRAPID_ALWAYS_INLINE ArrayContainer &resize (const ShapeType &shape);
302
+
301
303
template <typename T>
302
304
LIBRAPID_ALWAYS_INLINE ArrayContainer &operator +=(const T &other);
303
305
@@ -817,6 +819,19 @@ namespace librapid {
817
819
m_storage[index ] = value;
818
820
}
819
821
822
+ template <typename ShapeType_, typename StorageType_>
823
+ LIBRAPID_ALWAYS_INLINE auto
824
+ ArrayContainer<ShapeType_, StorageType_>::resize(const ShapeType &shape)
825
+ -> ArrayContainer & {
826
+ LIBRAPID_ASSERT (shape.size () == m_size,
827
+ " Size of new shape ({}) must equal size of old shape ({})" ,
828
+ shape.size (),
829
+ m_size);
830
+ m_shape = shape;
831
+ m_size = shape.size ();
832
+ return *this ;
833
+ }
834
+
820
835
template <typename ShapeType_, typename StorageType_>
821
836
template <typename T>
822
837
LIBRAPID_ALWAYS_INLINE auto
Original file line number Diff line number Diff line change @@ -28,14 +28,14 @@ namespace librapid {
28
28
Scalar derivative;
29
29
30
30
Dual () = default ;
31
- explicit Dual (Scalar value) : value(value), derivative(Scalar()) {}
31
+ Dual (Scalar value) : value(value), derivative(Scalar()) {}
32
32
Dual (Scalar value, Scalar derivative) : value(value), derivative(derivative) {}
33
33
34
34
template <typename U>
35
- explicit Dual (const Dual<U> &other) : value(other.value), derivative(other.derivative) {}
35
+ Dual (const Dual<U> &other) : value(other.value), derivative(other.derivative) {}
36
36
37
37
template <typename U>
38
- explicit Dual (Dual<U> &&other) :
38
+ Dual (Dual<U> &&other) :
39
39
value (std::move(other.value)), derivative(std::move(other.derivative)) {}
40
40
41
41
template <typename U>
You can’t perform that action at this time.
0 commit comments