Prev: make_array - or auto deducing the number of elements to std::array
Next: Does covariant return types hold for non-virtual?
From: vijk on 10 May 2010 04:38 Looking for something similar to a map type, but which allows me to define a new type (possibly via templates?) at compile time, with the expected NAMES filled in. Values will come in at runtime. so just to illustrate : supposing i have 2 valid names with expected values :- name,age so foo.name = "myname"; foo.age=99; //ok foo.address="moderated road"; // error at compile time Now, i know you might say why dont you go off and define your own class and use a map for underlying implementation? The reason i dont want to do that is that i would have tons of classes. So just looking for a slick way to maintain a constrained name-value dictionary with the names defined at compile time. -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |