Use the DUNE_VERSION* macros to distinguish between Dune >= 2.6 and < 2.6. Employ the correspondingly correct types, constructors and function calls for Mappers and ReferenceElements.
DUNE_VERSION*