MySQL++

Ticket Change Details
Login
Overview

Artifact ID: 777f03557222dad24f7620d97c49ba6f9eac74ccb29e477e65867154ff9035a8
Ticket: 97f62ef016ea3d71fffb3a110400b9b2477aff15
Convert auto_ptr in lib/refcounted.h to unique_ptr
User & Date: anonymous 2018-05-02 15:38:33
Changes

  1. icomment:
    Here is a proposed patch to add std::unique_ptr support:
    
    diff --git a/mysql++-3.2.3/lib/dbdriver.cpp b/mysql++-3.2.3/lib/dbdriver.cpp
    index 8d43d1a..73287c6 100644
    --- a/mysql++-3.2.3/lib/dbdriver.cpp
    +++ b/mysql++-3.2.3/lib/dbdriver.cpp
    @@ -300,7 +300,11 @@ bool
     DBDriver::set_option_impl(Option* o)
     {
            std::ostringstream os;
    +#if __cplusplus >= 201103L
    +       std::unique_ptr<Option> cleanup(o);
    +#else
            std::auto_ptr<Option> cleanup(o);
    +#endif
     
            switch (o->set(this)) {
                    case Option::err_NONE:
    diff --git a/mysql++-3.2.3/lib/refcounted.h b/mysql++-3.2.3/lib/refcounted.h
    index 0869682..d985e1d 100644
    --- a/mysql++-3.2.3/lib/refcounted.h
    +++ b/mysql++-3.2.3/lib/refcounted.h
    @@ -101,7 +101,11 @@ public:
            counted_(c),
            refs_(0)
            {
    +#if __cplusplus >= 201103L
    +               std::unique_ptr<T> exception_guard(counted_);
    +#else
                    std::auto_ptr<T> exception_guard(counted_);
    +#endif
                    if (counted_) {
                            refs_ = new size_t(1);
                    }
    
  2. login: "anonymous"
  3. mimetype: "text/x-fossil-plain"