jeudi 19 juillet 2018

c++11: assigning global STL "map

Does anybody know why this code crashes on "map" line with error message:"Debug assert failed: invalid null point" ?

#include <cstdint>
#include <map>
#include <string>

map<string, string> VarZeroTable = {
    { "bool",      "false" },
    { "int",       "0" },
    { "char",      '\0' },
    { "float",     "0.0"},
    { "double",    "0.0"},
    { "string",    "\"\"" },
    { "short",     "0" },
    { "long",      "0" },
    { "uint64_t",  "0" },
    { "uint32_t",  "0" },
    { "uint16_t",  "0" },
    { "uint8_t",   "0" },
    { "uintmax_t", "0" },
    { "int8_t",    "0" },
    { "int16_t",   "0" },
    { "int32_t",   "0" },
    { "int64_t",   "0" },
    { "intptr_t",  "nullptr" },
    { "uintptr_t", "uintptr_t" },
    { "size_t",    "0" },
    { "ptrdiff_t", "0"}
};

void main() {
    int count VarZeroTable.count("int64_t");
}

Aucun commentaire:

Enregistrer un commentaire