yahoo / mdbm

MDBM a very fast memory-mapped key/value store.
BSD 3-Clause "New" or "Revised" License
992 stars 111 forks source link

Fix error: ‘template<class> class std::auto_ptr’ is deprecated #61

Closed guoxiao closed 8 years ago

guoxiao commented 8 years ago

use unique_ptr instead

areese commented 8 years ago

@guoxiao, it seems like the build failed: "CppUnitTestRunnerLocal.cc:158:5: error: ‘unique_ptr’ does not name a type CppUnitTestRunnerLocal.cc:160:5: error: ‘unique_ptr’ does not name a type CppUnitTestRunnerLocal.cc: In constructor ‘ComboOutputter::ComboOutputter(CppUnit::TestResultCollector*, const string&)’:"

Does unique_ptr only exist on a newer c++ standard?

steve-carney commented 8 years ago

Unique_ptr is from newish c++11. Not all of the internal stack has upgraded to this newer version.

From: Allen Reese [mailto:notifications@github.com] Sent: Monday, 18 April, 2016 10:20 To: yahoo/mdbm mdbm@noreply.github.com Subject: Re: [yahoo/mdbm] Fix error: ‘template class std::auto_ptr’ is deprecated (#61)

@guoxiao https://github.com/guoxiao , it seems like the build failed: "CppUnitTestRunnerLocal.cc:158:5: error: ‘unique_ptr’ does not name a type CppUnitTestRunnerLocal.cc:160:5: error: ‘unique_ptr’ does not name a type CppUnitTestRunnerLocal.cc: In constructor ‘ComboOutputter::ComboOutputter(CppUnit::TestResultCollector*, const string&)’:"

Does unique_ptr only exist on a newer c++ standard?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/yahoo/mdbm/pull/61#issuecomment-211483348 https://github.com/notifications/beacon/AHJP7D3q9eo4gfDHQOSNlttiQLDdz8Szks5p471CgaJpZM4IJAmf.gif

guoxiao commented 8 years ago

Since the default build options include -Werror, the build will fail with newer compiler.

I think I should add some check and use auto_ptr and unique_ptr for old and new compiler separately.

areese commented 8 years ago

@steve-carney I'm more worried about failing on new compilers than doing internal fixups.

Is there an ifdef we can use to pick if it should be auto_ptr or unique_ptr?

areese commented 8 years ago

duh. Nevermind that: " +#include // unique_ptr +#if __cplusplus <= 199711L

That works for me.

Thanks @guoxiao, I think this is good.