"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ginac/container.h" between
ginac-1.7.11.tar.bz2 and ginac-1.8.0.tar.bz2

About: GiNaC (GiNaC is Not a CAS (Computer Algebra System)) is a C++ library for symbolic calculations.

container.h  (ginac-1.7.11.tar.bz2):container.h  (ginac-1.8.0.tar.bz2)
skipping to change at line 70 skipping to change at line 70
protected: protected:
~container_storage() {} ~container_storage() {}
}; };
template <> template <>
inline void container_storage<std::vector>::reserve(size_t n) { seq.reserve(n); } inline void container_storage<std::vector>::reserve(size_t n) { seq.reserve(n); }
template <> template <>
inline void container_storage<std::vector>::reserve(std::vector<ex> & v, size_t n) { v.reserve(n); } inline void container_storage<std::vector>::reserve(std::vector<ex> & v, size_t n) { v.reserve(n); }
/** Helper template to allow initialization of containers via an overloaded
* comma operator (idea stolen from Blitz++). */
template <typename T, typename STLT>
class container_init {
public:
container_init(STLT & s) : stlt(s) {}
container_init<T, STLT> operator,(const T & x)
{
stlt.push_back(x);
return container_init<T, STLT>(stlt);
}
// The following specializations produce much tighter code than the
// general case above
container_init<T, STLT> operator,(int x)
{
stlt.push_back(x);
return container_init<T, STLT>(stlt);
}
container_init<T, STLT> operator,(unsigned int x)
{
stlt.push_back(x);
return container_init<T, STLT>(stlt);
}
container_init<T, STLT> operator,(long x)
{
stlt.push_back(x);
return container_init<T, STLT>(stlt);
}
container_init<T, STLT> operator,(unsigned long x)
{
stlt.push_back(x);
return container_init<T, STLT>(stlt);
}
container_init<T, STLT> operator,(double x)
{
stlt.push_back(x);
return container_init<T, STLT>(stlt);
}
container_init<T, STLT> operator,(const symbol & x)
{
stlt.push_back(T(x));
return container_init<T, STLT>(stlt);
}
private:
container_init();
STLT & stlt;
};
/** Wrapper template for making GiNaC classes out of STL containers. */ /** Wrapper template for making GiNaC classes out of STL containers. */
template <template <class T, class = std::allocator<T>> class C> template <template <class T, class = std::allocator<T>> class C>
class container : public basic, public container_storage<C> { class container : public basic, public container_storage<C> {
GINAC_DECLARE_REGISTERED_CLASS(container, basic) GINAC_DECLARE_REGISTERED_CLASS(container, basic)
protected: protected:
typedef typename container_storage<C>::STLT STLT; typedef typename container_storage<C>::STLT STLT;
public: public:
typedef typename STLT::const_iterator const_iterator; typedef typename STLT::const_iterator const_iterator;
typedef typename STLT::const_reverse_iterator const_reverse_iterator; typedef typename STLT::const_reverse_iterator const_reverse_iterator;
skipping to change at line 170 skipping to change at line 113
{ {
setflag(get_default_flags()); setflag(get_default_flags());
} }
container(std::initializer_list<ex> il) container(std::initializer_list<ex> il)
: container_storage<C>(il) : container_storage<C>(il)
{ {
setflag(get_default_flags()); setflag(get_default_flags());
} }
explicit container(const ex & p1) attribute_deprecated;
container(const ex & p1, const ex & p2) attribute_deprecated;
container(const ex & p1, const ex & p2, const ex & p3) attribute_deprecat
ed;
container(const ex & p1, const ex & p2, const ex & p3, const ex & p4) att
ribute_deprecated;
container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, con
st ex & p5) attribute_deprecated;
container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, con
st ex & p5, const ex & p6) attribute_deprecated;
container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, con
st ex & p5, const ex & p6, const ex & p7) attribute_deprecated;
container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, con
st ex & p5, const ex & p6, const ex & p7, const ex & p8) attribute_deprecated;
container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, con
st ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9) attribute_deprecated;
container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, con
st ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9, const ex & p10) attribute_deprecated;
container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, con
st ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9, const ex & p10, const ex & p11) attribute_deprec
ated;
container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, con
st ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9, const ex & p10, const ex & p11, const ex & p12)
attribute_deprecated;
container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, con
st ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9, const ex & p10, const ex & p11, const ex & p12,
const ex & p13) attribute_deprecated;
container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, con
st ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9, const ex & p10, const ex & p11, const ex & p12,
const ex & p13, const ex & p14) attribute_deprecated;
container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, con
st ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9, const ex & p10, const ex & p11, const ex & p12,
const ex & p13, const ex & p14, const ex & p15) attribute_deprecated;
container(const ex & p1, const ex & p2, const ex & p3, const ex & p4, con
st ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9, const ex & p10, const ex & p11, const ex & p12,
const ex & p13, const ex & p14, const ex & p15, const ex & p16) attribute_deprec
ated;
// First step of initialization of container with a comma-separated
// sequence of expressions. Subsequent steps are handled by
// container_init<>::operator,().
container_init<ex, STLT> operator=(const ex & x) attribute_deprecated;
// functions overriding virtual functions from base classes // functions overriding virtual functions from base classes
public: public:
bool info(unsigned inf) const override { return inherited::info(inf); } bool info(unsigned inf) const override { return inherited::info(inf); }
unsigned precedence() const override { return 10; } unsigned precedence() const override { return 10; }
size_t nops() const override { return this->seq.size(); } size_t nops() const override { return this->seq.size(); }
ex op(size_t i) const override; ex op(size_t i) const override;
ex & let_op(size_t i) override; ex & let_op(size_t i) override;
ex subs(const exmap & m, unsigned options = 0) const override; ex subs(const exmap & m, unsigned options = 0) const override;
void read_archive(const archive_node &n, lst &sym_lst) override void read_archive(const archive_node &n, lst &sym_lst) override
skipping to change at line 345 skipping to change at line 258
STLT subschildren(const exmap & m, unsigned options = 0) const; STLT subschildren(const exmap & m, unsigned options = 0) const;
}; };
/** Default constructor */ /** Default constructor */
template <template <class T, class = std::allocator<T>> class C> template <template <class T, class = std::allocator<T>> class C>
container<C>::container() container<C>::container()
{ {
setflag(get_default_flags()); setflag(get_default_flags());
} }
/** Deprecatd constructors (prefer initializer list) */
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1)
: container_storage<C>(1, p1) { setflag(get_default_flags()); }
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2)
: container_storage<C>{p1, p2} { setflag(get_default_flags()); }
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2, const ex & p3)
: container_storage<C>{p1, p2, p3} { setflag(get_default_flags()); }
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex &
p4)
: container_storage<C>{p1, p2, p3, p4} { setflag(get_default_flags()); }
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex &
p4, const ex & p5)
: container_storage<C>{p1, p2, p3, p4, p5} { setflag(get_default_flags()); }
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex &
p4, const ex & p5, const ex & p6)
: container_storage<C>{p1, p2, p3, p4, p5, p6} { setflag(get_default_flags());
}
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex &
p4, const ex & p5, const ex & p6, const ex & p7)
: container_storage<C>{p1, p2, p3, p4, p5, p6, p7} { setflag(get_default_flags
()); }
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex &
p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8)
: container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8} { setflag(get_default_f
lags()); }
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex &
p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9)
: container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9} { setflag(get_defau
lt_flags()); }
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex &
p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9, const ex & p10)
: container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10} { setflag(get_
default_flags()); }
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex &
p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9, const ex & p10, const ex & p11)
: container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11} { setflag
(get_default_flags()); }
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex &
p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9, const ex & p10, const ex & p11, const ex
& p12)
: container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12} { se
tflag(get_default_flags()); }
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex &
p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9, const ex & p10, const ex & p11, const ex
& p12, const ex & p13)
: container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13}
{ setflag(get_default_flags()); }
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex &
p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9, const ex & p10, const ex & p11, const ex
& p12, const ex & p13, const ex & p14)
: container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13,
p14} { setflag(get_default_flags()); }
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex &
p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9, const ex & p10, const ex & p11, const ex
& p12, const ex & p13, const ex & p14, const ex & p15)
: container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13,
p14, p15} { setflag(get_default_flags()); }
template <template <class T, class = std::allocator<T>> class C>
container<C>::container(const ex & p1, const ex & p2, const ex & p3, const ex &
p4, const ex & p5, const ex & p6, const ex & p7, const ex & p8,
const ex & p9, const ex & p10, const ex & p11, const ex
& p12, const ex & p13, const ex & p14, const ex & p15, const ex & p16)
: container_storage<C>{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13,
p14, p15, p16} { setflag(get_default_flags()); }
template <template <class T, class = std::allocator<T>> class C>
container_init<ex, typename container_storage<C>::STLT> container<C>::operator=(
const ex & x)
{
this->seq.push_back(x);
return container_init<ex, typename container_storage<C>::STLT>(this->seq)
;
}
template <template <class T, class = std::allocator<T>> class C> template <template <class T, class = std::allocator<T>> class C>
void container<C>::do_print(const print_context & c, unsigned level) const void container<C>::do_print(const print_context & c, unsigned level) const
{ {
// always print brackets around seq, ignore upper_precedence // always print brackets around seq, ignore upper_precedence
printseq(c, get_open_delim(), ',', get_close_delim(), precedence(), prece dence()+1); printseq(c, get_open_delim(), ',', get_close_delim(), precedence(), prece dence()+1);
} }
template <template <class T, class = std::allocator<T>> class C> template <template <class T, class = std::allocator<T>> class C>
void container<C>::do_print_tree(const print_tree & c, unsigned level) const void container<C>::do_print_tree(const print_tree & c, unsigned level) const
{ {
 End of changes. 3 change blocks. 
218 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)