mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-20 11:48:25 -06:00
added: map predicate
use it to allow for serializing nested maps
This commit is contained in:
parent
14070fdfcb
commit
2d2f25b778
@ -246,6 +246,8 @@ public:
|
|||||||
this->vector(d);
|
this->vector(d);
|
||||||
else if constexpr (is_ptr<Data>::value)
|
else if constexpr (is_ptr<Data>::value)
|
||||||
this->ptr(d);
|
this->ptr(d);
|
||||||
|
else if constexpr (is_map<Data>::value)
|
||||||
|
this->map(d);
|
||||||
else if constexpr (has_serializeOp<Data>::value)
|
else if constexpr (has_serializeOp<Data>::value)
|
||||||
d.serializeOp(*this);
|
d.serializeOp(*this);
|
||||||
else
|
else
|
||||||
@ -464,6 +466,22 @@ protected:
|
|||||||
constexpr static bool value = true;
|
constexpr static bool value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! \brief Predicate for maps
|
||||||
|
template<class T>
|
||||||
|
struct is_map {
|
||||||
|
constexpr static bool value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class Key, class T, class Compare, class Allocator>
|
||||||
|
struct is_map<std::map<Key,T,Compare,Allocator>> {
|
||||||
|
constexpr static bool value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class Key, class T, class Hash, class KeyEqual, class Allocator>
|
||||||
|
struct is_map<std::unordered_map<Key,T,Hash,KeyEqual,Allocator>> {
|
||||||
|
constexpr static bool value = true;
|
||||||
|
};
|
||||||
|
|
||||||
//! Detect existence of \c serializeOp member function
|
//! Detect existence of \c serializeOp member function
|
||||||
//!
|
//!
|
||||||
//! Base case (no \c serializeOp member function)
|
//! Base case (no \c serializeOp member function)
|
||||||
|
Loading…
Reference in New Issue
Block a user