Skip to content
Snippets Groups Projects
Forked from Core Modules / dune-geometry
Source project has a limited visibility.
Carsten Gräser's avatar
Carsten Gräser authored
Contrain GeometryType template constructor

The templated constructor is supposed to be used with
types modelling a `TopologyType`, i.e., types providing
`::dimension` and `::id`. This MR constrains the overload
to such types only.

This fixes the problem that dune-functions cannot be
build with clang and libstdc++-6. For the same reason
the `PQkLocalFiniteElementCache` could not be used with
this combination which is unfortunately not triggered
by any test.

Since the reason is far from obvious I'll give a short summary:

* Dune-functions uses `PQkLocalFiniteElementCache`.
* The copy constructor and `get()` function of `PQkLocalFiniteElementCache`
  use `operator[](const GeometryType&)` of `std::map<GeometryType,Foo>`.
* When called with an l-value, the `operator[]` of an `std::map<T, Foo>`
  checks if `T` can be constructed from a `tuple<...>`. (*)
* This check fails to compile with the very greedy templated constructor

```cpp
template<class TopologyType> GeometryType(TopologyType);
```

Notice that I don't understand the purpose of the check in (*)
which spans over about 20 levels of template instantiation context.
E.g. it does not happen if `operator[]` is called with an r-value as
argument.

By constraining the constructor to only be available for appropriate
types we can avoid this problem.

See merge request !32
448af15f
History
Name Last commit Last update