OGS
Properties-impl.h File Reference

Detailed Description

Implemenatiom of the template part of the class Properties.

Definition in file Properties-impl.h.

#include <typeinfo>
Include dependency graph for Properties-impl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename Function >
void applyToPropertyVectors (Properties const &properties, Function f)
 

Function Documentation

◆ applyToPropertyVectors()

template<typename Function >
void applyToPropertyVectors ( Properties const & properties,
Function f )

Definition at line 245 of file Properties-impl.h.

246{
247 for (auto [name, property] : properties)
248 {
249 // Open question, why is the 'unsigned long' case not compiling giving
250 // an error "expected '(' for function-style cast or type construction"
251 // with clang-7, and "error C4576: a parenthesized type followed by an
252 // initializer list is a non-standard explicit type conversion syntax"
253 // with MSVC-15.
254 bool success = f(double{}, property) || f(float{}, property) ||
255 f(int{}, property) || f(unsigned{}, property) ||
256 f(long{}, property) ||
257 f(static_cast<unsigned long>(0), property) ||
258 f(std::size_t{}, property) || f(char{}, property) ||
259 f(static_cast<unsigned char>(0), property);
260 if (!success)
261 {
262 OGS_FATAL("Could not apply function to PropertyVector '{:s}'.",
263 property->getPropertyName());
264 }
265 }
266}
#define OGS_FATAL(...)
Definition Error.h:26

References OGS_FATAL.

Referenced by main(), ApplicationUtils::partitionProperties(), and ApplicationUtils::writeProperties().