|
Boost : |
From: Andy Little (andy_at_[hidden])
Date: 2006-01-30 15:00:06
"Reece Dunn" wrote
> But the solution is still using templates. You don't need to have a template
> to use std::[w]string. Thus, if you wanted to move:
>
> __declspec(dllexport)
> void some_function( const std::string & str );
>
> to use fixed_string with the implementation you mention, you would need to
> expose the implementation of some_function to your customers and thus cannot
> use it as part of a library (.lib) or DLL.
The limitations of templates are widely known. The advantages are too. If the
advantages dont appear in this case then there is little point in using
templates. If it needs to be implementable as part of a DLL then it obviously
cant practically have compile time fixed capacity, but that is the trade off you
have to make ( OTOH maybe you could instantiate a few useful sizes, so maybe its
not impossible). It strikes me that the design radically changed midstream
and you now have a strange hybrid. This is the source of a lot of confusion with
the result that potential users throw up their hands and move on. Are you
designing a string with a compile time fixed size or are you dessigning a
string with a construction time fixed capacity, if so then why not a runtime
variable capacity? What requirements must the class satisfy? What are the
limitations imposed by these requirements? What then are the advantages over
std::string etc, etc.
regards
Andy Little
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk