Don't Needlessly Capture Constant Buffer Size

A lambda expression can read the value of a variable without
capturing it if the variable

    has const non-volatile integral or enumeration type and
    has been initialized with a constant expression

Clang issues a diagnostic if such variables are captured so drop the
'sz' from the explicit list of captures.
This commit is contained in:
Bård Skaflestad
2022-02-24 09:48:12 +01:00
parent a85ec1a7e6
commit 982ed7caf0

View File

@@ -367,7 +367,7 @@ void Opm::data::InterRegFlowMap::CSR::condenseDuplicates()
void Opm::data::InterRegFlowMap::CSR::accumulateFlowRates(const RateBuffer& v)
{
const auto sz = Window::bufferSize();
constexpr auto sz = Window::bufferSize();
if (v.size() != this->compressedIdx_.size()*sz) {
throw std::logic_error {
@@ -375,14 +375,14 @@ void Opm::data::InterRegFlowMap::CSR::accumulateFlowRates(const RateBuffer& v)
};
}
auto dst = [this, sz](const Offset start) -> Window
auto dst = [this](const Offset start) -> Window
{
auto begin = this->sa_.begin() + start*sz;
return Window { begin, begin + sz };
};
auto src = [&v, sz](const Offset start) -> ReadOnlyWindow
auto src = [&v](const Offset start) -> ReadOnlyWindow
{
auto begin = v.begin() + start*sz;