[GiNaC-devel] Class container vs. the holy standard?

Richard B. Kreckel kreckel at ginac.de
Sun Apr 16 22:39:57 CEST 2006


Hi,

Triggered by Debian bug #362220 [0] I submitted GCC bug report #27178 
[1] only to be told that container.h made use of a GCC extension that 
will have been removed from GCC in the upcoming 4.2.0 release [2].  
Basically, where we were simply writing this:

  template <template <class> class> class container;
  typedef container<std::list> lst;

we now have to write the more cumbersome:

  template <template <class, class> class> class container;
  typedef container<std::list> lst;

This is because std::list has two template parameters, the element type 
and the allocator type.  Ugh.

It's ugly, because the intent was clearly to not bother the user with 
implementation details like the allocator. From the user's perspective, 
the intent is to express "container of T", never mind what type of 
container.  I've attached a patch against CVS GiNaC-1.3 that converts 
all places flaged as errors in GCC 4.2 20060415 (experimental) to:

  template <template <class T, class = std::allocator<T> > class> class X;
  typedef X<std::list> lst;

This is ugly as sin, because I don't think that we really wanted to 
express "STL-container of T", as the changed code now appears to imply.

Any suggestions?

  -richy.

[0] <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=362220>
[1] <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27178>
[2] <http://gcc.gnu.org/gcc-4.2/changes.html>, first bullet under C++

-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: container.patch
Type: text/x-patch
Size: 7744 bytes
Desc: not available
Url : http://www.cebix.net/pipermail/ginac-devel/attachments/20060416/09127545/container.bin


More information about the GiNaC-devel mailing list