]> www.ginac.de Git - ginac.git/blobdiff - ginac/ncmul.cpp
A better return_type_tinfo() mechanism.
[ginac.git] / ginac / ncmul.cpp
index 5a7b94f8733adcebc7d1b83d7b5390ea23aef696..e0bc7dee4d12fe95c605b7aeedb4b1c7bd227774 100644 (file)
@@ -124,7 +124,7 @@ bool ncmul::info(unsigned inf) const
        return inherited::info(inf);
 }
 
-typedef std::vector<int> intvector;
+typedef std::vector<std::size_t> uintvector;
 
 ex ncmul::expand(unsigned options) const
 {
@@ -134,8 +134,8 @@ ex ncmul::expand(unsigned options) const
        
        // Now, look for all the factors that are sums and remember their
        // position and number of terms.
-       intvector positions_of_adds(expanded_seq.size());
-       intvector number_of_add_operands(expanded_seq.size());
+       uintvector positions_of_adds(expanded_seq.size());
+       uintvector number_of_add_operands(expanded_seq.size());
 
        size_t number_of_adds = 0;
        size_t number_of_expanded_terms = 1;
@@ -167,7 +167,7 @@ ex ncmul::expand(unsigned options) const
        exvector distrseq;
        distrseq.reserve(number_of_expanded_terms);
 
-       intvector k(number_of_adds);
+       uintvector k(number_of_adds);
 
        /* Rename indices in the static members of the product */
        exvector expanded_seq_mod;
@@ -401,13 +401,13 @@ ex ncmul::eval(int level) const
 
                size_t assoc_num = assocseq.size();
                exvectorvector evv;
-               std::vector<tinfo_t> rttinfos;
+               std::vector<return_type_t> rttinfos;
                evv.reserve(assoc_num);
                rttinfos.reserve(assoc_num);
 
                cit = assocseq.begin(), citend = assocseq.end();
                while (cit != citend) {
-                       tinfo_t ti = cit->return_type_tinfo();
+                       return_type_t ti = cit->return_type_tinfo();
                        size_t rtt_num = rttinfos.size();
                        // search type in vector of known types
                        for (i=0; i<rtt_num; ++i) {
@@ -578,10 +578,10 @@ unsigned ncmul::return_type() const
        return all_commutative ? return_types::commutative : return_types::noncommutative;
 }
    
-tinfo_t ncmul::return_type_tinfo() const
+return_type_t ncmul::return_type_tinfo() const
 {
        if (seq.empty())
-               return this;
+               return make_return_type_t<ncmul>();
 
        // return type_info of first noncommutative element
        exvector::const_iterator i = seq.begin(), end = seq.end();
@@ -592,7 +592,7 @@ tinfo_t ncmul::return_type_tinfo() const
        }
 
        // no noncommutative element found, should not happen
-       return this;
+       return make_return_type_t<ncmul>();
 }
 
 //////////