diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2020-08-21 14:25:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-21 14:25:21 +0200 |
commit | c81e0454f1d6a2a5dc4d0d0c84be7e8c22a5038d (patch) | |
tree | 07d4d887e8b464ea312d546368b63b021a453058 | |
parent | 53ac0545ce37c867745c618a29eb6f82b538fc8a (diff) | |
parent | 7bc0aecc3d80e8d105be68f329ede4a8c3a3fc6e (diff) | |
download | ATCD-c81e0454f1d6a2a5dc4d0d0c84be7e8c22a5038d.tar.gz |
Merge pull request #1211 from jwillemsen/jwi-uniqueptr2
Make use of C++11 std::unique_ptr
-rw-r--r-- | ACE/ACEXML/examples/SAXPrint/main.cpp | 5 | ||||
-rw-r--r-- | ACE/examples/APG/Naming/Name_Binding.h | 4 | ||||
-rw-r--r-- | ACE/examples/APG/Reactor/HAStatus.cpp | 6 | ||||
-rw-r--r-- | ACE/tests/Bug_2540_Regression_Test.cpp | 4 | ||||
-rw-r--r-- | ACE/tests/Bug_2820_Regression_Test.cpp | 5 | ||||
-rw-r--r-- | ACE/tests/DLL_Test.cpp | 4 |
6 files changed, 24 insertions, 4 deletions
diff --git a/ACE/ACEXML/examples/SAXPrint/main.cpp b/ACE/ACEXML/examples/SAXPrint/main.cpp index ea61c506050..a0264368c8a 100644 --- a/ACE/ACEXML/examples/SAXPrint/main.cpp +++ b/ACE/ACEXML/examples/SAXPrint/main.cpp @@ -144,7 +144,12 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_NEW_RETURN (handler, ACEXML_SAXPrint_Handler (name), -1); + +#if defined (ACE_HAS_CPP11) + std::unique_ptr<ACEXML_DefaultHandler> cleanup_handler (handler); +#else auto_ptr<ACEXML_DefaultHandler> cleanup_handler (handler); +#endif ACEXML_Parser parser; ACEXML_InputSource input (stm); diff --git a/ACE/examples/APG/Naming/Name_Binding.h b/ACE/examples/APG/Naming/Name_Binding.h index a359600c634..e40c717383a 100644 --- a/ACE/examples/APG/Naming/Name_Binding.h +++ b/ACE/examples/APG/Naming/Name_Binding.h @@ -53,7 +53,11 @@ private: char *type_; }; +#if defined ACE_HAS_CPP11 +typedef std::unique_ptr<Name_Binding> Name_Binding_Ptr; +#else typedef auto_ptr<Name_Binding> Name_Binding_Ptr; +#endif // Listing 1 #endif /* NAME_BINDING_H */ diff --git a/ACE/examples/APG/Reactor/HAStatus.cpp b/ACE/examples/APG/Reactor/HAStatus.cpp index a36e5955393..c424fd86aec 100644 --- a/ACE/examples/APG/Reactor/HAStatus.cpp +++ b/ACE/examples/APG/Reactor/HAStatus.cpp @@ -93,9 +93,13 @@ ClientAcceptor::open (const ACE_INET_Addr &listen_addr) int ClientAcceptor::handle_input (ACE_HANDLE) { - ClientService *client; + ClientService *client = 0; ACE_NEW_RETURN (client, ClientService, -1); +#if defined ACE_HAS_CPP11 + std::unique_ptr<ClientService> p (client); +#else auto_ptr<ClientService> p (client); +#endif if (this->acceptor_.accept (client->peer ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, diff --git a/ACE/tests/Bug_2540_Regression_Test.cpp b/ACE/tests/Bug_2540_Regression_Test.cpp index d552fa453dc..5cfc8a53303 100644 --- a/ACE/tests/Bug_2540_Regression_Test.cpp +++ b/ACE/tests/Bug_2540_Regression_Test.cpp @@ -105,7 +105,11 @@ run_main (int, ACE_TCHAR *[]) // happen with ACE_WFMO_Reactor. ACE_Select_Reactor *impl_ptr = 0; ACE_NEW_RETURN (impl_ptr, ACE_Select_Reactor, -1); +#if defined (ACE_HAS_CPP11) + std::unique_ptr<ACE_Select_Reactor> auto_impl (impl_ptr); +#else auto_ptr<ACE_Select_Reactor> auto_impl (impl_ptr); +#endif ACE_Reactor reactor (impl_ptr); diff --git a/ACE/tests/Bug_2820_Regression_Test.cpp b/ACE/tests/Bug_2820_Regression_Test.cpp index b0d54655dd0..8ef8f3a6b20 100644 --- a/ACE/tests/Bug_2820_Regression_Test.cpp +++ b/ACE/tests/Bug_2820_Regression_Test.cpp @@ -43,13 +43,12 @@ run_main (int, ACE_TCHAR *[]) int result = 0; - auto_ptr<ACE_Reactor> reactor( - new ACE_Reactor(new ACE_Select_Reactor, 1)); - #if defined ACE_HAS_CPP11 + std::unique_ptr<ACE_Reactor> reactor(new ACE_Reactor(new ACE_Select_Reactor, 1)); ACE_Event_Handler_var v = ACE::make_event_handler<Simple_Handler> (reactor.get()); #else + auto_ptr<ACE_Reactor> reactor(new ACE_Reactor(new ACE_Select_Reactor, 1)); ACE_Event_Handler_var v( new Simple_Handler(reactor.get())); #endif diff --git a/ACE/tests/DLL_Test.cpp b/ACE/tests/DLL_Test.cpp index 6afb08ca341..7b8a39f1f37 100644 --- a/ACE/tests/DLL_Test.cpp +++ b/ACE/tests/DLL_Test.cpp @@ -93,7 +93,11 @@ int basic_test (ACE_DLL &dll) dll.error ()), -1); +#if defined ACE_HAS_CPP11 + std::unique_ptr<Hello> my_hello (factory ()); +#else auto_ptr<Hello> my_hello (factory ()); +#endif // Make the method calls, as the object pointer is available. my_hello->say_hello (); |