Let's add Brian's excellent explanation to the BTS:
* brian m. carlson <[EMAIL PROTECTED]> [2007-12-09 22:01]:
> On Sun, Dec 09, 2007 at 01:49:44PM -0700, Martin Michlmayr wrote:
>> What about
>>
>> ./common/string.hpp:495: error: explicit template specialization cannot
>> have a storage class
>>
>> for
>>
>> the line
>>
>> template<> static inline void swap(acommon::String & x, acommon::String &
>> y) {return x.swap(y);}
>
> "static" is a storage class. This is an explicit template specialization
> because one or more of the template parameters are brought out of the
> template and given a specific instance (in this case, acommon::String
> instead of the template parameter T (or whatever it's called)). The
> compiler will use the specialization in preference to the more generic
> version, but they are instances of the same template.
>
> Since specializations are special-cases of a certain template, they must
> have the same storage class as the corresponding template. Hence using a
> storage class specifier is not allowed.
>
> In this case, remove the "static" to make it work. If this is in a
> library, it may also be desirable to place the function in the "std"
> namespace, since then it will be exported as *the* swap function for
> acommon::String, which is probably what you want.
>
> --
> brian m. carlson / brian with sandals: Houston, Texas, US
> +1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only
> a typesetting engine: http://crustytoothpaste.ath.cx/~bmc/code/thwack
> OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
--
Martin Michlmayr
http://www.cyrius.com/
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]