[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Converting std::string to wxString
From: |
Greg Chicares |
Subject: |
Re: [lmi] Converting std::string to wxString |
Date: |
Mon, 6 Feb 2017 19:37:57 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 |
On 2017-02-06 17:50, Vadim Zeitlin wrote:
> On Mon, 6 Feb 2017 16:57:16 +0000 Greg Chicares <address@hidden> wrote:
[...]
> GC> But let me ask this: if I just do whatever seems simplest to me, can I
> GC> trust the compiler to give a warning whenever I've oversimplified?
> GC> "Code for simplicity, but don't commit anything that doesn't compile"
> GC> is a rule I can memorize.
[...]
> I actually do have a solution for this: we've been asked many times (maybe
> even by you too?) to remove implicit wxString conversions to "const char*"
> and "const wchar_t*" in the default build or to "std::string" and
> "std::wstring" in the wxUSE_STL==1 one. We can't do it by default because
> it would break too much existing code, especially in !wxUSE_STL case, but I
> agree that it would be a good idea to allow opting in to this safer
> behaviour, e.g. allow predefining some wxDISABLE_IMPLICIT_WXSTRING_CONV to
> ensure that the code implicitly converting wxString to std::string doesn't
> compile. If we did this, then your rule above would work without any
> exceptions -- but only if/when you updated to the latest wxWidgets version.
>
> Please let me know if this is something you'd be ready to do.
Yes. And we'll want to update xmlwrapp too:
# XMLWRAPP !! '-Wno-deprecated-declarations' needed for auto_ptr
BTW, I figured I should double-check that before hitting "Send", and...
https://github.com/vslavik/xmlwrapp/blob/master/src/libxml/cpp11.h
// Define auto_ptr<> as either std::auto_ptr<> or std::unique_ptr<> to allow
// compiling the code in both C++ dialects without getting the warnings about
// auto_ptr<> being deprecated in C++11 code.
//
// Notice that our xml::impl::auto_ptr<> is more like scoped_ptr<>, but we
// can't call it this as we don't have type aliases in C++03 and so we can only
// bring std::auto_ptr<> in scope but not rename it to scoped_ptr<> there.
Wouldn't
s/scoped/std::unique/
make the second paragraph better? I assume you intend to use only
standard smart pointers, but IIRC scoped_ptr is a boost-only thing.