MultiTypeBlockVector: Inherit tuple constructors
- Makes member function count
const
- Inherits tuple constructors so that MultiTypeBlockVector can be constructed from existing Vectors, or we can even construct it with references to existing vectors.
- Test construction from references in the test
- Fixes the static_assert in the test that shouldn't really have compiled before
Merge request reports
Activity
Fails for clang with
/builds/tkoch/dune-istl/dune/istl/test/multitypeblockvectortest.cc:32:19: error: static_assert expression is not an integral constant expression static_assert(multiVector.size()==2, "Method MultiTypeBlockVector::size() returned wrong value!"); ^~~~~~~~~~~~~~~~~~~~~ /builds/tkoch/dune-istl/dune/istl/test/multitypeblockvectortest.cc:90:3: note: in instantiation of function template specialization 'testMultiVector<Dune::BlockVector<Dune::FieldVector<double, 3>, std::allocator<Dune::FieldVector<double, 3> > >, Dune::BlockVector<Dune::FieldVector<double, 1>, std::allocator<Dune::FieldVector<double, 1> > > >' requested here testMultiVector(multiVector); ^
However I don't see how this is related to the changes in this branch. I guess because multiVector is now tested in the function scope somehow?
Edited by Timo Kochadded 1 commit
- b427926f - [test][multitypeblockvector] Test construction of MultiTypeBlockVector of references of Vectors
@oliver.sander can you comment on this proposal? Is there a reason MultiTypeBlockVector only has a default constructor?
Edited by Timo Koch(... I don't see why the old
static_assert
worked. The LHS of the.
is always evaluated, even if the RHS denotes a static member. I guess the compiler was a bit permissive ...)added 1 commit
- d045b48c - [test][multitypeblockvector] Test construction of MultiTypeBlockVector of references of Vectors
added 1 commit
- 6020d45d - [test][multitypeblockvector] Test construction of MultiTypeBlockVector of references of Vectors
(... OK, new hypothesis: the old
static_assert
worked because clang never does the lvalue-to-rvalue conversion for the lhs of a.
. If the lhs is a function-local automatic variable, the "identity" (address) of that variable is known sufficiently to be constexpr, even if the value is not. If the lhs is passed into the function as a reference, then it's identity is definitely not constexpr within that function. Of course, to add to the confusion, only clang seems to be strict about that, gcc considers the result constexpr either way...)@tkoch , I will merge this, but please add a short note to
CHANGELOG.md
first.added 1 commit
- ed7eaecc - [changelog] Add entry for new MultiTypeBlockVector constructors
added 1 commit
- ce4a4d94 - [changelog] Add entry for new MultiTypeBlockVector constructors
enabled an automatic merge when the pipeline for ce4a4d94 succeeds
mentioned in commit 54ee6051
mentioned in commit tkoch/dune-istl@448c0881
mentioned in merge request !242 (merged)
mentioned in commit bb0fee97
mentioned in merge request !395 (merged)