I am creating a static std::unordered_map
as follows:
auto* __epsgMap__ = new std::unordered_map <int/*EPSG*/, CRS::Info> ({
{3819, CRS::Info("HD1909","+proj=longlat +ellps=bessel +towgs84=595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408 +no_defs")},
{3821, CRS::Info("TWD67","+proj=longlat +ellps=aust_SA +no_defs")},
{3824, CRS::Info("TWD97","+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs")},
{3889, CRS::Info("IGRS","+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs")},
{3906, CRS::Info("MGI 1901","+proj=longlat +ellps=bessel +towgs84=682,-203,480,0,0,0,0 +no_defs")},
{4001, CRS::Info("Unknown datum based upon the Airy 1830 ellipsoid","+proj=longlat +ellps=airy +no_defs")},
...
...
});
This map has 5k+ entries, hence, on MSVC, allocating it results in stack overflow (I guess it pushes an std::initializer_list
on the stack).
How can I allocate this, witout successive calls to insert()
?
** Edit **
Tried to do this in an allocater function with successive calls to std::unordered_map::insert()
but is overflows the stack anyway when the allocator function is called (it probably pushes all the elements onto the stack anyway)