1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| template <class T, class U>
struct same_type {
static const bool value = false;
};
template <class T>
struct same_type<T, T> {
static const bool value = true;
};
class Fille;
template <class T>
struct has_a_string_string_map {
static_assert(same_type<std::map<std::string, std::string>, decltype(T::maMap)>::value, "pas de string string map");
};
class Fille {
friend struct has_a_string_string_map<Fille>;
static std::map<std::string, std::string> maMap;
has_a_string_string_map<Fille> check; // doit être à la fin
};
std::map<std::string, std::string> Fille::maMap; |
Partager