C++17 modernization: add [[nodiscard]] to operator==()

dprior
Sébastien Villemot 2024-01-09 13:04:33 +01:00
parent cb7bd0778b
commit 4683b9aeb6
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
10 changed files with 14 additions and 14 deletions

View File

@ -240,7 +240,7 @@ public:
real = r;
}
virtual ~_matrix_iter() = default;
bool
[[nodiscard]] bool
operator==(const _Self& it) const
{
return ptr == it.ptr;

View File

@ -211,7 +211,7 @@ public:
return s;
}
// Exact equality
bool operator==(const ConstVector& y) const;
[[nodiscard]] bool operator==(const ConstVector& y) const;
// Lexicographic ordering
[[nodiscard]] std::partial_ordering operator<=>(const ConstVector& y) const;

View File

@ -75,7 +75,7 @@ public:
OrdSequence() : data()
{
}
bool operator==(const OrdSequence& s) const;
[[nodiscard]] bool operator==(const OrdSequence& s) const;
int operator[](int i) const;
[[nodiscard]] std::partial_ordering operator<=>(const OrdSequence& s) const;
[[nodiscard]] const std::vector<int>&
@ -121,7 +121,7 @@ public:
// Copy constructor plus gluing i1 and i2 in one class
Equivalence(const Equivalence& e, int i1, int i2);
bool operator==(const Equivalence& e) const;
[[nodiscard]] bool operator==(const Equivalence& e) const;
[[nodiscard]] int
getN() const
{

View File

@ -76,7 +76,7 @@ public:
// Constructs the tensor dimensions for slicing (see the implementation for details)
TensorDimens(const IntSequence& ss, const IntSequence& coor);
bool
[[nodiscard]] bool
operator==(const TensorDimens& td) const
{
return nvs == td.nvs && sym == td.sym;

View File

@ -120,7 +120,7 @@ public:
if (destroy)
delete[] data;
}
bool operator==(const IntSequence& s) const;
[[nodiscard]] bool operator==(const IntSequence& s) const;
int&
operator[](int i)
{

View File

@ -1,6 +1,6 @@
/*
* Copyright © 2004 Ondra Kamenik
* Copyright © 2019-2023 Dynare Team
* Copyright © 2019-2024 Dynare Team
*
* This file is part of Dynare.
*
@ -86,7 +86,7 @@ public:
KronProdDimens& operator=(const KronProdDimens& kd) = default;
KronProdDimens& operator=(KronProdDimens&& kd) = default;
bool
[[nodiscard]] bool
operator==(const KronProdDimens& kd) const
{
return rows == kd.rows && cols == kd.cols;

View File

@ -1,6 +1,6 @@
/*
* Copyright © 2004 Ondra Kamenik
* Copyright © 2019-2023 Dynare Team
* Copyright © 2019-2024 Dynare Team
*
* This file is part of Dynare.
*
@ -95,7 +95,7 @@ public:
Permutation(const Permutation& p, int i) : permap(p.permap.insert(p.size(), i))
{
}
bool
[[nodiscard]] bool
operator==(const Permutation& p) const
{
return permap == p.permap;

View File

@ -1,6 +1,6 @@
/*
* Copyright © 2004 Ondra Kamenik
* Copyright © 2019-2023 Dynare Team
* Copyright © 2019-2024 Dynare Team
*
* This file is part of Dynare.
*
@ -115,7 +115,7 @@ public:
{
per.apply(nvmax);
}
bool
[[nodiscard]] bool
operator==(const PerTensorDimens& td) const
{
return TensorDimens::operator==(td) && per == td.per;

View File

@ -126,7 +126,7 @@ public:
{
return run;
}
bool
[[nodiscard]] bool
operator==(const symiterator& it)
{
return dim == it.dim && run == it.run;

View File

@ -150,7 +150,7 @@ public:
{
return offset;
}
bool
[[nodiscard]] bool
operator==(const index& n) const
{
return offset == n.offset;