beltoforion/muparser

Example regarding querying variables

Closed this issue · 1 comments

TomFD commented

While for constants, the following works:

	mu::valmap_type cmap_c = parser.GetConst();
	if (cmap_c.size())
	{
		mu::valmap_type::const_iterator item = cmap_c.begin();
		for (; item != cmap_c.end(); ++item)
		{

for variables, the iterator cannot be a const_iterator as given in the example, but works with

	mu::varmap_type variables = parser.GetVar();
	
	if (variables.size())
	{
		mu::varmap_type::iterator item = variables.begin();
		for (; item != variables.end(); ++item)
		{

A variable isn't a constant though. You can change the value via the iterator.