17 typedef JAutoMap_t::value_type value_type;
22 struct JElement_t :
public value_type
29 template<> JElement_t::JElement_t(
JType<char>) : value_type(1,
"char") {}
30 template<> JElement_t::JElement_t(
JType<int>) : value_type(2,
"int") {}
31 template<> JElement_t::JElement_t(
JType<float>) : value_type(3,
"float") {}
32 template<> JElement_t::JElement_t(
JType<double>) : value_type(4,
"double") {}
37 template<>
template<> value_type JAutoMap_t::getAutoElement(
JType<char> ) {
return value_type(1,
"char"); }
38 template<>
template<> value_type JAutoMap_t::getAutoElement(
JType<int> ) {
return value_type(2,
"int"); }
39 template<>
template<> value_type JAutoMap_t::getAutoElement(
JType<float> ) {
return value_type(3,
"float"); }
40 template<>
template<> value_type JAutoMap_t::getAutoElement(
JType<double>) {
return value_type(4,
"double"); }
51 int main(
int argc,
char **argv)
59 JParser<> zap(
"Example program to test automatic generation of map based on data types.");
65 catch(
const exception &error) {
66 FATAL(error.what() << endl);
81 zmap.insert<JDataTypes_t>();
83 for (JAutoMap_t::const_iterator i = zmap.begin(); i != zmap.end(); ++i)
84 cout << setw(2) << i->first <<
' ' << i->second << endl;
92 for (JAutoMap_t::const_iterator i = zmap.begin(); i != zmap.end(); ++i)
93 cout << setw(2) << i->first <<
' ' << i->second << endl;