X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fsymbol.cpp;h=e5e7a08d3e4f838359ac50b2d431758530e71ebd;hp=4d73c9eb4328b1ed232a3c95e5f3bf6c9aaa37a3;hb=aac4cec4d116f0b39daddb35181d1aa85297d4ba;hpb=286b0d93528e35957a50c51343e0b4a9bc623bce diff --git a/ginac/symbol.cpp b/ginac/symbol.cpp index 4d73c9eb..e5e7a08d 100644 --- a/ginac/symbol.cpp +++ b/ginac/symbol.cpp @@ -3,7 +3,7 @@ * Implementation of GiNaC's symbolic objects. */ /* - * GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2020 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +23,6 @@ #include "symbol.h" #include "lst.h" #include "archive.h" -#include "tostring.h" #include "utils.h" #include "hash_seed.h" #include "inifcns.h" @@ -106,9 +105,9 @@ void symbol::read_archive(const archive_node &n, lst &sym_lst) n.find_string("name", tmp_name); // If symbol is in sym_lst, return the existing symbol - for (lst::const_iterator it = sym_lst.begin(); it != sym_lst.end(); ++it) { - if (is_a(*it) && (ex_to(*it).name == tmp_name)) { - *this = ex_to(*it); + for (auto & s : sym_lst) { + if (is_a(s) && (ex_to(s).name == tmp_name)) { + *this = ex_to(s); // XXX: This method is responsible for reading realsymbol // and possymbol objects too. But // basic::operator=(const basic& other) @@ -153,13 +152,19 @@ static const std::string& get_default_TeX_name(const std::string& name); std::string symbol::get_name() const { if (name.empty()) { - std::ostringstream s; - s << "symbol" << serial; - name = s.str(); + name = "symbol" + std::to_string(serial); } return name; } +std::string symbol::get_TeX_name() const +{ + if (TeX_name.empty()) { + return get_default_TeX_name(get_name()); + } + return TeX_name; +} + // protected void symbol::do_print(const print_context & c, unsigned level) const