cyberdstar / muparserx

Automatically exported from code.google.com/p/muparserx
Other
0 stars 0 forks source link

Expressions with multiple output values not supported? #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to run this code:
mup::ParserX parser(mup::pckCOMMON | mup::pckNON_COMPLEX | mup::pckMATRIX | 
mup::pckUNIT);
mup::Value value2{3, 0};
mup::Variable variable2{&value2};
parser.DefineVar("v2", variable2);
parser.SetExpr("v2[0]*v2[0], v2[1]*v2[1], v2[2]*v2[2]");
try {
    const auto& temp = parser.Eval();
} catch(mup::ParserError &e) {
    cout << e.GetMsg() << endl;
}

What is the expected output?
No exception.

What do you see instead?
Exception: Unexpected comma found at position 11.

What version of the product are you using?

3.0.1, macosx

If this is indeed supported the documentation does not mention it: 
https://code.google.com/p/muparserx/wiki/Using

I tried Eval(int) but that gave a compilation error:
error: no matching function for call to 'mup::ParserX::Eval(int&)'
note: candidate is:
const mup::IValue& mup::ParserXBase::Eval() const

Original issue reported on code.google.com by ilja.j.h...@nasa.gov on 8 Jul 2014 at 5:02

GoogleCodeExporter commented 9 years ago
This is no longer supported. You can now use the new array constructor {.. , 
.., ..}:

parser.SetExpr("{v2[0]*v2[0], v2[1]*v2[1], v2[2]*v2[2]}");

This will create an array containing all results. 

Original comment by ib...@gmx.info on 9 Jul 2014 at 7:18

GoogleCodeExporter commented 9 years ago
Closed as per last comment. (Feature was removed; alternate way is available)

Original comment by ib...@gmx.info on 14 Jul 2014 at 8:49