Skip to content

Commit

Permalink
Remove unescessary copy constr. and op=
Browse files Browse the repository at this point in the history
  • Loading branch information
hivert committed Nov 1, 2023
1 parent 825841a commit 7644826
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 23 deletions.
8 changes: 1 addition & 7 deletions include/hpcombi/perm16.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,13 @@ struct alignas(16) PTransf16 : public Vect16 {
using array = typename decltype(Epu8)::array;

PTransf16() = default;
constexpr PTransf16(const PTransf16 &v) = default;

constexpr PTransf16(const vect v) : Vect16(v) {}
constexpr PTransf16(const epu8 x) : Vect16(x) {}
PTransf16(std::vector<uint8_t> dom, std::vector<uint8_t> rng,
size_t = 0 /* unused */);
PTransf16(std::initializer_list<uint8_t> il);

PTransf16 &operator=(const PTransf16 &) = default;
PTransf16 &operator=(const epu8 &vv) {
v = vv;
return *this;
}

//! Return whether \c *this is a well constructed object
bool validate(size_t k = 16) const {
return HPCombi::is_partial_transformation(v, k);
Expand Down
8 changes: 0 additions & 8 deletions include/hpcombi/vect16.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,11 @@ struct alignas(16) Vect16 {
epu8 v;

Vect16() = default;
constexpr Vect16(const Vect16 &v) = default;

constexpr Vect16(epu8 x) : v(x) {}
Vect16(std::initializer_list<uint8_t> il, uint8_t def = 0)
: v(Epu8(il, def)) {}
constexpr operator epu8() const { return v; }

Vect16 &operator=(const Vect16 &) = default;
Vect16 &operator=(const epu8 &vv) {
v = vv;
return *this;
}

array &as_array() { return HPCombi::as_array(v); }
const array &as_array() const { return HPCombi::as_array(v); }

Expand Down
9 changes: 1 addition & 8 deletions include/hpcombi/vect_generic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,14 @@ template <size_t Size, typename Expo = uint8_t> struct VectGeneric {
array v;

VectGeneric() = default;
constexpr VectGeneric(const VectGeneric &v) = default;

VectGeneric(const std::array<Expo, Size> &_v) : v(_v) {} // NOLINT
VectGeneric(const array &_v) : v(_v) {} // NOLINT
VectGeneric(std::initializer_list<Expo> il, Expo def = 0) {
HPCOMBI_ASSERT(il.size() <= Size);
std::copy(il.begin(), il.end(), v.begin());
std::fill(v.begin() + il.size(), v.end(), def);
}

VectGeneric &operator=(const VectGeneric &) = default;
VectGeneric &operator=(const array &vv) {
v = vv;
return *this;
}

Expo operator[](uint64_t i) const { return v[i]; }
Expo &operator[](uint64_t i) { return v[i]; }

Expand Down

0 comments on commit 7644826

Please sign in to comment.