X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fcontainer.h;h=28cf05e44546ee511ad8d888a2d046fb63afe634;hp=242395b62c2e2d215b09c325ca1bb93e76e63d6c;hb=619e0e9352eed4807f064879c057be75185dc83f;hpb=96af2609db413ddf70371e0423e6c07ecb5ee813 diff --git a/ginac/container.h b/ginac/container.h index 242395b6..28cf05e4 100644 --- a/ginac/container.h +++ b/ginac/container.h @@ -3,7 +3,7 @@ * Wrapper template for making GiNaC classes out of STL containers. */ /* - * GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2006 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 @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __GINAC_CONTAINER_H__ @@ -137,7 +137,7 @@ public: protected: // helpers - static unsigned get_tinfo() { return TINFO_fail; } + static tinfo_t get_tinfo() { return NULL; } static unsigned get_default_flags() { return 0; } static char get_open_delim() { return '('; } static char get_close_delim() { return ')'; } @@ -187,7 +187,7 @@ public: } container(const ex & p1, const ex & p2, const ex & p3, - const ex & p4) : inherited(get_tinfo()) + const ex & p4) : inherited(get_tinfo()) { setflag(get_default_flags()); reserve(this->seq, 4); @@ -394,6 +394,28 @@ protected: return *this; } + ex real_part() const + { + STLT cont; + reserve(cont, nops()); + const_iterator b = begin(); + const_iterator e = end(); + for(const_iterator i=b; i!=e; ++i) + cont.push_back(i->real_part()); + return thiscontainer(cont); + } + + ex imag_part() const + { + STLT cont; + reserve(cont, nops()); + const_iterator b = begin(); + const_iterator e = end(); + for(const_iterator i=b; i!=e; ++i) + cont.push_back(i->imag_part()); + return thiscontainer(cont); + } + bool is_equal_same_type(const basic & other) const; // new virtual functions which can be overridden by derived classes @@ -502,7 +524,7 @@ void container::do_print(const print_context & c, unsigned level) const template