Subject: [boost] Any interest in a string literal selector helper library?

> Hi all,
> 
> I have written a relatively small library which I've found pretty useful
> in my own projects.  I have to deal with std::basic_string objects a lot
> in my applications, and I almost always write template code so that the
> same code works with both std::string and std::wstring types.  The only
> problem which cannot be directly solved with existing language construct
> is handling string literals.
> 
> To make myself clear, the below code will only work for f< char >():
> 
>  template < typename char_type >
>  void f()
>  {
>   std::basic_string< char_type > str( "hello" );
>  }
> 
> What is needed here is some facility which selects either "hello" or
> L"hello" based upon char_type.  Now, using my library, the above code
> can be fixed like this:
> 
>  template < typename char_type >
>  void g()
>  {
>   std::basic_string< char_type > str( TextAutoSelect( char_type, "hello"
> ) );
>  }
> 
I've done this before as well.
But it's a very simple function.
And I assume TestAutoSelect is a macro.
Can I take a look at the code?

Best,
John



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to