]> www.ginac.de Git - ginac.git/commitdiff
Remove C++89 workaround for closing angle brackets in nested templates.
authorRichard Kreckel <kreckel@ginac.de>
Sat, 7 Nov 2015 12:23:26 +0000 (13:23 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Sat, 7 Nov 2015 21:02:05 +0000 (22:02 +0100)
check/time_hashmap.cpp
doc/CodingStyle
doc/examples/lanczos.cpp
ginac/container.h
ginac/ex.h
ginac/factor.cpp
ginac/inifcns_nstdsums.cpp
ginac/polynomial/collect_vargs.h
ginac/ptr.h
ginac/registrar.h

index 4d065b216300bfd93ba171e0ddc4e7effb62e34b..e7c1d258113efc88932a01d69ecceb3599531819 100644 (file)
@@ -82,10 +82,10 @@ unsigned time_hashmap()
        for (vector<unsigned>::const_iterator i = sizes.begin(); i != sizes.end(); ++i) {
                double time_insert, time_find, time_erase;
 
-               run_timing< exhashmap<ex> >(*i, time_insert, time_find, time_erase);
+               run_timing<exhashmap<ex>>(*i, time_insert, time_find, time_erase);
 
 // If you like, you can compare it with this:
-//             run_timing< std::map<ex, ex, ex_is_less> >(*i, time_insert, time_find, time_erase);
+//             run_timing<std::map<ex, ex, ex_is_less>>(*i, time_insert, time_find, time_erase);
 
                times_insert.push_back(time_insert);
                times_find.push_back(time_find);
index 4ac0f189ff19973e31f170129d3e987193eeed9f..e387bf294eb5a02e7ef95714bb11af96feea53e8 100644 (file)
@@ -208,12 +208,10 @@ after (or before, in the case of postfix '++' and '--') unary operators:
        x = -(y + z) / 2;
 
 There are no spaces around the '<' and '>' used to designate template
-parameters. Unfortunately, a design flaw in C++ requires putting a space
-between two consecutive closing '>'s. We suggest that in this case you also
-put a space after the opening '<':
+parameters:
 
        vector<int> vi;
-       vector< list<int> > vli;
+       vector<list<int>> vli;
 
 '*' and '&' in the declaration of pointer-to and reference-to variables
 have a space before, but not after them:
index d1dce8c1dd053bc77804320c81e198635e751d8d..627bb3f87865bb2c79174b0d0e3012fbaad4b124 100644 (file)
@@ -66,7 +66,7 @@ using namespace cln;
  * Chebyshev polynomial coefficient matrix as far as is required for
  * the Lanczos approximation.
  */
-void calc_chebyshev(vector<vector<cl_I> >& C, const size_t size)
+void calc_chebyshev(vector<vector<cl_I>>& C, const size_t size)
 {      
        C.reserve(size);
        for (size_t i=0; i<size; ++i)
@@ -85,7 +85,7 @@ void calc_chebyshev(vector<vector<cl_I> >& C, const size_t size)
 /*
  * The coefficients p_n(g) that occur in the Lanczos approximation.
  */
-const cl_F p(const size_t k, const cl_F& g, const vector<vector<cln::cl_I> >& C)
+const cl_F p(const size_t k, const cl_F& g, const vector<vector<cln::cl_I>>& C)
 {      
        const float_format_t prec = float_format(g);
        const cl_F sqrtPi = sqrt(pi(prec));
@@ -110,7 +110,7 @@ const cl_F p(const size_t k, const cl_F& g, const vector<vector<cln::cl_I> >& C)
 void calc_lanczos_coeffs(vector<cl_F>& lanc, const cln::cl_F& g)
 {      
        const size_t n = lanc.size();
-       vector<vector<cln::cl_I> > C;
+       vector<vector<cln::cl_I>> C;
        calc_chebyshev(C, 2*n+2);
        
        // \Pi_{i=1}^n (z-i+1)/(z+i) = \Pi_{i=1}^n (1 - (2i-1)/(z+i))
@@ -118,7 +118,7 @@ void calc_lanczos_coeffs(vector<cl_F>& lanc, const cln::cl_F& g)
        // Q[1/(z+1),...1/(z+n)] of degree 1. To store coefficients of this
        // polynomial we use vector<cl_I>, so the set of such polynomials is
        // stored as
-       vector<vector<cln::cl_I> > fractions(n);
+       vector<vector<cln::cl_I>> fractions(n);
        
        // xi = 1/(z+i)
        fractions[0] = vector<cl_I>(1);
index 3c1ac47eb688356fcd740f93149c358b1959715b..5ba094349486656e1024b6b07de6ed74a6869537 100644 (file)
@@ -38,7 +38,7 @@
 namespace GiNaC {
 
 /** Helper template for encapsulating the reserve() mechanics 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_storage {
 protected:
        typedef C<ex> STLT;
@@ -124,7 +124,7 @@ private:
 };
 
 /** 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> {
        GINAC_DECLARE_REGISTERED_CLASS(container, basic)
 protected:
@@ -493,21 +493,21 @@ protected:
 };
 
 /** 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()
 {
        setflag(get_default_flags());
 }
 
 
-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
 {
        // always print brackets around seq, ignore upper_precedence
        printseq(c, get_open_delim(), ',', get_close_delim(), precedence(), precedence()+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
 {
        c.s << std::string(level, ' ') << class_name() << " @" << this
@@ -522,20 +522,20 @@ void container<C>::do_print_tree(const print_tree & c, unsigned level) const
        c.s << std::string(level + c.delta_indent,' ') << "=====" << std::endl;
 }
 
-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_python(const print_python & c, unsigned level) const
 {
        printseq(c, '[', ',', ']', precedence(), precedence()+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_python_repr(const print_python_repr & c, unsigned level) const
 {
        c.s << class_name();
        printseq(c, '(', ',', ')', precedence(), precedence()+1);
 }
 
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 ex container<C>::op(size_t i) const
 {
        GINAC_ASSERT(i < nops());
@@ -545,7 +545,7 @@ ex container<C>::op(size_t i) const
        return *it;
 }
 
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 ex & container<C>::let_op(size_t i)
 {
        GINAC_ASSERT(i < nops());
@@ -556,7 +556,7 @@ ex & container<C>::let_op(size_t i)
        return *it;
 }
 
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 ex container<C>::eval(int level) const
 {
        if (level == 1)
@@ -565,7 +565,7 @@ ex container<C>::eval(int level) const
                return thiscontainer(evalchildren(level));
 }
 
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 ex container<C>::subs(const exmap & m, unsigned options) const
 {
        // After having subs'ed all children, this method subs'es one final
@@ -579,12 +579,12 @@ ex container<C>::subs(const exmap & m, unsigned options) const
        STLT subsed = subschildren(m, options);
        if (!subsed.empty()) {
                ex result(thiscontainer(subsed));
-               if (is_a<container<C> >(result))
+               if (is_a<container<C>>(result))
                        return ex_to<basic>(result).subs_one_level(m, options);
                else
                        return result;
        } else {
-               if (is_a<container<C> >(*this))
+               if (is_a<container<C>>(*this))
                        return subs_one_level(m, options);
                else
                        return *this;
@@ -592,7 +592,7 @@ ex container<C>::subs(const exmap & m, unsigned options) const
 }
 
 /** Compare two containers of the same type. */
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 int container<C>::compare_same_type(const basic & other) const
 {
        GINAC_ASSERT(is_a<container>(other));
@@ -611,7 +611,7 @@ int container<C>::compare_same_type(const basic & other) const
        return (it1 == it1end) ? (it2 == it2end ? 0 : -1) : 1;
 }
 
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 bool container<C>::is_equal_same_type(const basic & other) const
 {
        GINAC_ASSERT(is_a<container>(other));
@@ -631,7 +631,7 @@ bool container<C>::is_equal_same_type(const basic & other) const
 }
 
 /** Add element at front. */
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 container<C> & container<C>::prepend(const ex & b)
 {
        ensure_if_modifiable();
@@ -640,7 +640,7 @@ container<C> & container<C>::prepend(const ex & b)
 }
 
 /** Add element at back. */
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 container<C> & container<C>::append(const ex & b)
 {
        ensure_if_modifiable();
@@ -649,7 +649,7 @@ container<C> & container<C>::append(const ex & b)
 }
 
 /** Remove first element. */
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 container<C> & container<C>::remove_first()
 {
        ensure_if_modifiable();
@@ -658,7 +658,7 @@ container<C> & container<C>::remove_first()
 }
 
 /** Remove last element. */
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 container<C> & container<C>::remove_last()
 {
        ensure_if_modifiable();
@@ -667,7 +667,7 @@ container<C> & container<C>::remove_last()
 }
 
 /** Remove all elements. */
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 container<C> & container<C>::remove_all()
 {
        ensure_if_modifiable();
@@ -676,7 +676,7 @@ container<C> & container<C>::remove_all()
 }
 
 /** Sort elements. */
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 container<C> & container<C>::sort()
 {
        ensure_if_modifiable();
@@ -691,7 +691,7 @@ template<> inline void container<std::list>::unique_()
 }
 
 /** Remove adjacent duplicate elements. */
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 container<C> & container<C>::unique()
 {
        ensure_if_modifiable();
@@ -700,7 +700,7 @@ container<C> & container<C>::unique()
 }
 
 /** Print sequence of contained elements. */
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 void container<C>::printseq(const print_context & c, char openbracket, char delim,
                             char closebracket, unsigned this_precedence,
                             unsigned upper_precedence) const
@@ -723,7 +723,7 @@ void container<C>::printseq(const print_context & c, char openbracket, char deli
                c.s << closebracket;
 }
 
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 typename container<C>::STLT container<C>::evalchildren(int level) const
 {
        if (level == 1)
@@ -744,7 +744,7 @@ typename container<C>::STLT container<C>::evalchildren(int level) const
        return s;
 }
 
-template <template <class T, class = std::allocator<T> > class C>
+template <template <class T, class = std::allocator<T>> class C>
 typename container<C>::STLT container<C>::subschildren(const exmap & m, unsigned options) const
 {
        // returns an empty container if nothing had to be substituted
index e27abe502629c84236216094ca68d8601d572dc4..8512a4c7157e7ee26e5179557ac745e0326cc47b 100644 (file)
@@ -542,7 +542,7 @@ public:
        }
 
 private:
-       std::stack<internal::_iter_rep, std::vector<internal::_iter_rep> > s;
+       std::stack<internal::_iter_rep, std::vector<internal::_iter_rep>> s;
 
        void increment()
        {
@@ -607,7 +607,7 @@ public:
        }
 
 private:
-       std::stack<internal::_iter_rep, std::vector<internal::_iter_rep> > s;
+       std::stack<internal::_iter_rep, std::vector<internal::_iter_rep>> s;
 
        void descend()
        {
index 5ff3cd38c73074cf89f5ae64459c101f749cfb4c..33b8f50125ed853f36ff9a0ceb3480504419e61f 100644 (file)
@@ -118,7 +118,7 @@ ostream& operator<<(ostream& o, const vector<numeric>& v)
        }
        return o;
 }
-ostream& operator<<(ostream& o, const vector< vector<cl_MI> >& v)
+ostream& operator<<(ostream& o, const vector<vector<cl_MI>>& v)
 {
        auto i = v.begin(), end = v.end();
        while ( i != end ) {
@@ -1462,7 +1462,7 @@ private:
        }
 private:
        umodpoly lr[2];
-       vector< vector<umodpoly> > cache;
+       vector<vector<umodpoly>> cache;
        upvec factors;
        umodpoly one;
        size_t n;
index eb98d7a9750e5ba257f6f6f960685f30527353e6..54d12c9b511060c2b53b6d28ca332200dd56c0ca 100644 (file)
@@ -102,7 +102,7 @@ namespace {
 
 // lookup table for factors built from Bernoulli numbers
 // see fill_Xn()
-std::vector<std::vector<cln::cl_N> > Xn;
+std::vector<std::vector<cln::cl_N>> Xn;
 // initial size of Xn that should suffice for 32bit machines (must be even)
 const int xninitsizestep = 26;
 int xninitsize = xninitsizestep;
@@ -1779,7 +1779,7 @@ namespace {
 
 // lookup table for special Euler-Zagier-Sums (used for S_n,p(x))
 // see fill_Yn()
-std::vector<std::vector<cln::cl_N> > Yn;
+std::vector<std::vector<cln::cl_N>> Yn;
 int ynsize = 0; // number of Yn[]
 int ynlength = 100; // initial length of all Yn[i]
 
@@ -3547,7 +3547,7 @@ static void initcX(std::vector<cln::cl_N>& crX,
 
        int Sm = 0;
        int Smp1 = 0;
-       std::vector<std::vector<cln::cl_N> > crG(s.size() - 1, std::vector<cln::cl_N>(L2 + 1));
+       std::vector<std::vector<cln::cl_N>> crG(s.size() - 1, std::vector<cln::cl_N>(L2 + 1));
        for (int m=0; m < (int)s.size() - 1; m++) {
                Sm += s[m];
                Smp1 = Sm + s[m+1];
@@ -3587,12 +3587,12 @@ static cln::cl_N crandall_Y_loop(const cln::cl_N& Sqk,
 
 
 // [Cra] section 4
-static void calc_f(std::vector<std::vector<cln::cl_N> >& f_kj,
+static void calc_f(std::vector<std::vector<cln::cl_N>>& f_kj,
                   const int maxr, const int L1)
 {
        cln::cl_N t0, t1, t2, t3, t4;
        int i, j, k;
-       std::vector<std::vector<cln::cl_N> >::iterator it = f_kj.begin();
+       std::vector<std::vector<cln::cl_N>>::iterator it = f_kj.begin();
        cln::cl_F one = cln::cl_float(1, cln::float_format(Digits));
        
        t0 = cln::exp(-lambda);
@@ -3616,7 +3616,7 @@ static void calc_f(std::vector<std::vector<cln::cl_N> >& f_kj,
 
 // [Cra] (3.1)
 static cln::cl_N crandall_Z(const std::vector<int>& s,
-                           const std::vector<std::vector<cln::cl_N> >& f_kj)
+                           const std::vector<std::vector<cln::cl_N>>& f_kj)
 {
        const int j = s.size();
 
@@ -3693,7 +3693,7 @@ cln::cl_N zeta_do_sum_Crandall(const std::vector<int>& s)
                }
        }
 
-       std::vector<std::vector<cln::cl_N> > f_kj(L1);
+       std::vector<std::vector<cln::cl_N>> f_kj(L1);
        calc_f(f_kj, maxr, L1);
 
        const cln::cl_N r0factorial = cln::factorial(r[0]-1);
index f2e557111666a9c5203e7c850924c784fd3b746d..b1bb64b328a935c8453e00ac336e0afb5e8855e2 100644 (file)
@@ -56,7 +56,7 @@ static inline bool zerop(const exp_vector_t& v)
        return true;
 }
 
-typedef std::vector<std::pair<exp_vector_t, ex> > ex_collect_t;
+typedef std::vector<std::pair<exp_vector_t, ex>> ex_collect_t;
 
 extern void
 collect_vargs(ex_collect_t& ec, const ex& e, const exvector& x);
index 5911dd675cb4efd07c1252380b00b078e00c2a7d..76c3ee7e4b21c40e199ced9f1cd580788388aa6d 100644 (file)
@@ -54,7 +54,7 @@ private:
  *      from refcounted)
  *    T* T::duplicate() member function (only if makewriteable() is used) */
 template <class T> class ptr {
-       friend class std::less< ptr<T> >;
+       friend class std::less<ptr<T>>;
 
        // NB: This implementation of reference counting is not thread-safe.
        // The reference counter needs to be incremented/decremented atomically,
@@ -155,7 +155,7 @@ namespace std {
 
 /** Specialization of std::less for ptr<T> to enable ordering of ptr<T>
  *  objects (e.g. for the use as std::map keys). */
-template <class T> struct less< GiNaC::ptr<T> >
+template <class T> struct less<GiNaC::ptr<T>>
  : public binary_function<GiNaC::ptr<T>, GiNaC::ptr<T>, bool> {
        bool operator()(const GiNaC::ptr<T> &lhs, const GiNaC::ptr<T> &rhs) const
        {
index cb3517168414a375c991ef448da71e70ce3ed283..5c97e6d176c1c2b6f20dfa481465178879d47f53 100644 (file)
@@ -36,7 +36,7 @@ namespace GiNaC {
 class ex;
 class archive_node;
 
-template <template <class T, class = std::allocator<T> > class> class container;
+template <template <class T, class = std::allocator<T>> class> class container;
 typedef container<std::list> lst;
 
 /** To distinguish between different kinds of non-commutative objects */