
block for reusable code. Effectively, code can use "type_maps" to handle an arbitrary structure, without needing to know member identifiers, and gets the speed Yes, but you'd need to know the types, and if a type is duplicated, as you say below, it would have to be wrapped in some class to make it unique. [snip] benefit of compile-time access resolution. int main() { NS::type_map<int, string> tmid; tmid = 3; tmid = "hello"; string s = tmid; cout << (int)tmid << ' ' << (string)tmid << ' ' << s << endl; cout << sizeof(tmid) << " vs " << sizeof(int) << '+' << sizeof(string) << endl; } So if I had: <--------------- struct sname_t { string first_m; string last_m; }; sname_t a_sname; a_sname.first_m="first"; a_sname.last_m="last"; ---------------
Hi Tony, On 10/31/2005 04:12 AM, Tony D wrote: [snip] then, to convert this to using typemaps, I would do: <--------------- struct fname_t: public string{...}; struct lname_t: public string{...}; NS:type_map<fname_t,lname_t> mname_t; mname_t a_mname; a_mname = fname_t("first"); a_mname = lname_t("last");
--------------
So I don't see that I've gained much, at least in this case. [snip]
cataloging errors. To store several data items of the same type, simply wrap each instance in a distinct class (possibly using the template w/ unique number idiom). [snip] -regards, Larry