• rdevlin.cronin's avatar
    Fix String16's move constructor · e6e968d0
    rdevlin.cronin authored
    String16 had a pseudo move constructor that took a const String16&&. The
    problem with this is that the point of moving objects is the ability to
    clobber the underlying data. If we look at this particular case, the
    move ctor tried to then std::move the underlying std::basic_string<>;
    this results in passing a const std::basic_string<>&& to the
    basic_string ctor. This resolves to the const std::basic_string<>&
    *copy* ctor. So in the end, we haven't moved anything.
    
    Fix this by taking a mutable rvalue reference that allows the moving to
    work as expected.
    
    BUG=None
    
    Review-Url: https://codereview.chromium.org/2616973002
    Cr-Commit-Position: refs/heads/master@{#42147}
    e6e968d0
string-16.h 4.63 KB