<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Richard,</p>
<p>but when I try to compile this program</p>
<p><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">#include
<ginac/ginac.h>
</span><br>
using namespace GiNaC;
<br>
<br>
int main(int argc, char** argv)
<br>
{
<br>
exprseq seq{1,2,3};
<br>
seq.prepend(0);
<br>
return 0;
<br>
}<br>
</span></p>
<div class="moz-cite-prefix">I get error:</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix"><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;"><span
style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">In file
included from /usr/include/ginac/lst.h:26,
</span><br>
from /usr/include/ginac/normal.h:29,
<br>
from /usr/include/ginac/ginac.h:31,
<br>
from test.cpp:24:
<br>
/usr/include/ginac/container.h: In instantiation of
‘GiNaC::container<C>& GiNaC::container<
<template-parameter-1-1> >::prepend(const
GiNaC::ex&) [with C = std::vector]’:
<br>
test.cpp:30:15: required from here
<br>
/usr/include/ginac/container.h:551:12: error:
‘GiNaC::container_storage<std::vector>::STLT’ {aka
‘class std::vector<GiNaC::ex>’} has no member named
‘push_front’
<br>
551 | this->seq.push_front(b);
<br>
| ~~~~~~~~~~^~~~~~~~~~<br>
</span></span></span></div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Why not change the code of prepend() in
container.h to use insert() instead of push_front()? Then I think
it will work for all STL containers.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Jan<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Am 02.03.22 um 23:44 schrieb Richard B.
Kreckel:<br>
</div>
<blockquote type="cite"
cite="mid:dd2f0ced-287a-efda-2cd9-d229a19c0b85@in.terlu.de">
<pre class="moz-quote-pre" wrap="">Hi Jan,
On 02.03.22 18:55, Jan Rheinländer wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">sometimes GiNaCs templates are a mystery to me. In container.h there is
the code
template<template<classT, class= std::allocator<T>> classC>
container<C> & container<C>::prepend(constex & b)
{
ensure_if_modifiable();
this->seq.push_front(b);
return*this;
}
but AFAIK the STL does not have any push_front() method. And GiNaC does
not seem to define it either. How can this work?
Same applies for pop_front() and sort()
voidsort_(std::input_iterator_tag)
{
this->seq.sort(ex_is_less());
}
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Well, not every STL container provides every possible method.
But the standard does require the ones you mention for the instantiated
template classes. Check again!
-richy.
</pre>
</blockquote>
</body>
</html>