[vtkusers] vtkStdString vs vtkstd::string
Francois Bertel
francois.bertel at kitware.com
Thu Jan 14 09:24:44 EST 2010
As a macro hater, can I suggest "namespace aliasing" instead?
Here is what I mean with a full example (just tested with gcc 4.4.1)
#include <iostream>
int main()
{
// define vtkstd as an alias to std
namespace vtkstd=std;
vtkstd::cout << "hello" << vtkstd::endl;
return 0;
}
On Thu, Jan 14, 2010 at 9:09 AM, Jeff Baumes <jeff.baumes at kitware.com> wrote:
> On Wed, Jan 13, 2010 at 7:15 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
>> The doc for vtkStdString says:
>>
>> Wrapper around vtkstd::string to keep symbols short.
>> vtkStdString derives from vtkstd::string to provide shorter symbol
>> names than basic_string<...> in namespace std given by the standard
>> STL string.
>>
>> But I guess I don't understand what that means. When should one use
>> vtkStdString vs vtkstd::string?
>
> I don't know the answer to your question, but it would be nice if all
> these pointed to the same underlying thing: std::string. I'm assuming
> the older compilers are responsible for the need for short symbols.
> Perhaps the compiler deprecation that Berk sent recently will allow us
> to eventually replace all vtkStdString and vtkstd::string with
> std::string?
>
> We are thinking to maybe start testing the use of std::string in the
> examples first.
>
> Longer term, we could do something like the following:
>
> typedef std::string vtkStdString;
> #define vtkstd std
>
> So the old type names could still be used, but we could in time
> replace all occurrences in VTK to just use std::string. Eventually the
> old aliases could be removed.
>
> But there could be unforeseen issues with this idea that force us to
> continue using vtkStdString/vtkstd::string.
>
> Jeff
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
--
François Bertel, PhD | Kitware Inc. Suite 204
1 (518) 371 3971 x113 | 28 Corporate Drive
| Clifton Park NY 12065, USA
More information about the vtkusers
mailing list