C++ Mathematical Expression Library (ExprTk) http://www.partow.net/programming/exprtk/index.html

This commit is contained in:
Arash Partow
2014-12-18 03:43:27 +11:00
parent 3dee9efa49
commit dd7ebec65a
2 changed files with 148 additions and 8 deletions

View File

@ -29538,6 +29538,12 @@ namespace exprtk
{
namespace details
{
template <typename T>
inline void print_type(const std::string& fmt, const T v, exprtk::details::numeric::details::real_type_tag)
{
printf(fmt.c_str(),v);
}
template <typename T>
struct print_impl
{
@ -29553,9 +29559,11 @@ namespace exprtk
{
generic_type& gt = parameters[i];
typename exprtk::details::numeric::details::number_type<T>::type num_type;
switch (gt.type)
{
case generic_type::e_scalar : printf(scalar_format.c_str(),scalar_t(gt)());
case generic_type::e_scalar : print_type(scalar_format.c_str(),scalar_t(gt)(),num_type);
break;
case generic_type::e_vector : {
@ -29563,7 +29571,8 @@ namespace exprtk
for (std::size_t x = 0; x < vector.size(); ++x)
{
printf(scalar_format.c_str(),vector[x]);
print_type(scalar_format.c_str(),vector[x],num_type);
if ((x + 1) < vector.size())
printf(" ");
}