[GiNaC-list] How can I get a GiNaC::ex's name
Warren Weckesser
wweckesser at mail.colgate.edu
Thu May 24 20:50:18 CEST 2007
This works for me:
string s = ex_to<symbol>(E).get_name();
For example,
---------------------------------------
#include <iostream>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;
int main()
{
ex e(symbol("abc"));
string s = ex_to<symbol>(e).get_name();
cout << s << endl;
return 0;
}
---------------------------------------
On Thu, 2007-05-24 at 18:46 +0800, Zhongxing Xu wrote:
> Hello,
>
> Say I construct an ex by:
> GiNaC::ex E(GiNaC::symbol("abc"));
>
> How can I get back "abc" from E as a C++ string or char*?
>
> Now I do this by print the ex to a std::ostringstream, and get the
> string from the ostringstream.
>
> Thanks.
>
> -- Zhongxing Xu
>
> _______________________________________________
> GiNaC-list mailing list
> GiNaC-list at ginac.de
> https://www.cebix.net/mailman/listinfo/ginac-list
More information about the GiNaC-list
mailing list