mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-07 01:06:54 +08:00
Add boot strapping of string parsing for pod types
This commit is contained in:
parent
1919d88f4f
commit
0a7d7958ab
@ -391,6 +391,14 @@ namespace dispatchkit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename Input>
|
||||||
|
Input parse_string(const std::string &i)
|
||||||
|
{
|
||||||
|
return boost::lexical_cast<Input>(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void bootstrap_pod_type(Dispatch_Engine &s, const std::string &name)
|
void bootstrap_pod_type(Dispatch_Engine &s, const std::string &name)
|
||||||
{
|
{
|
||||||
@ -401,6 +409,7 @@ namespace dispatchkit
|
|||||||
add_opers_arithmetic<T>(s);
|
add_opers_arithmetic<T>(s);
|
||||||
add_opers_arithmetic_modify_pod<T>(s);
|
add_opers_arithmetic_modify_pod<T>(s);
|
||||||
register_function(s, &to_string<T>, "to_string");
|
register_function(s, &to_string<T>, "to_string");
|
||||||
|
register_function(s, &parse_string<T>, "to_" + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Bootstrap
|
struct Bootstrap
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user