Question on explicit template expansion

Nathan Sidwell nathan@codesourcery.com
Fri May 13 14:24:00 GMT 2005


Garrett Kajmowicz wrote:
> I'm working on the embedded C++ library at cxx.uclibc.org
> 
> As a part of my work, I've been pushing some of the common template expansions 
> out into the binary library to reduce overall expansion.  This works well 
> *except* for constructors and destructors.  I would like an explanation as to 
> why the following occurs and what I can go to deal with it.
> 
> 
> Given (say) class string, I have:
> 
> //In the header file
> 
> template<class Ch, class Tr, class A> class basic_string {
> public:
> 	explicit basic_string(const A& al = A()) { return; }
> 	~basic_string() { }
> 
> //	<snip>
> //	<snip>
> //	<snip>
> 
> };
> 
> #ifndef __UCLIBCXX_COMPILE_STRING__
> 	template <> string::basic_string(const allocator<char> &);
> 	template <> string::~basic_string();
> #endif

This doesn't compile. Do you have a test case that does compile?

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



More information about the Gcc-help mailing list