feat(Core): enable C++17 (#2234)

Co-authored-by: Winfidonarleyan <dowlandtop@yandex.com>
This commit is contained in:
Francesco Borzì
2019-09-02 08:54:10 +02:00
committed by Kargatum
parent cae91f1650
commit 3a43e8c415
28 changed files with 61 additions and 46 deletions

View File

@@ -76,7 +76,6 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#include <memory>
#if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) && \
(ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0)
using std::auto_ptr;
#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
#else /* ACE_HAS_STANDARD_CPP_LIBRARY */

View File

@@ -116,7 +116,7 @@ public:
/// Constructor that initializes an ACE_Strong_Bound_Ptr by stealing
/// ownership of an object from an auto_ptr.
explicit ACE_Strong_Bound_Ptr (auto_ptr<X> p);
explicit ACE_Strong_Bound_Ptr (std::unique_ptr<X> p);
/// Copy constructor binds @c this and @a r to the same object.
ACE_Strong_Bound_Ptr (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r);
@@ -217,7 +217,7 @@ public:
/// Resets the ACE_Strong_Bound_Ptr to refer to a different
/// underlying object, ownership of which is stolen from the
/// auto_ptr.
void reset (auto_ptr<X> p);
void reset (std::unique_ptr<X> p);
/// Allows us to check for NULL on all ACE_Strong_Bound_Ptr
/// objects.

View File

@@ -149,7 +149,7 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (X *p)
}
template <class X, class ACE_LOCK> inline
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (auto_ptr<X> p)
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::ACE_Strong_Bound_Ptr (std::unique_ptr<X> p)
: counter_ (COUNTER::create_strong ()),
ptr_ (p.release())
{
@@ -304,7 +304,7 @@ ACE_Strong_Bound_Ptr<X, ACE_LOCK>::reset (X *p)
}
template<class X, class ACE_LOCK> inline void
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::reset (auto_ptr<X> p)
ACE_Strong_Bound_Ptr<X, ACE_LOCK>::reset(std::unique_ptr<X> p)
{
COUNTER *old_counter = this->counter_;
X_t *old_ptr = this->ptr_;

View File

@@ -3862,7 +3862,7 @@ ACE_OS::thr_create (ACE_THR_FUNC func,
else
thread_args = thread_adapter;
auto_ptr <ACE_Base_Thread_Adapter> auto_thread_args;
std::unique_ptr <ACE_Base_Thread_Adapter> auto_thread_args;
if (thread_adapter == 0)
ACE_auto_ptr_reset (auto_thread_args,

View File

@@ -243,7 +243,7 @@ ACE_Proactor_Handle_Timeout_Upcall::timeout (ACE_Proactor_Timer_Queue &,
ACE_TEXT ("create_asynch_timer failed")),
-1);
auto_ptr<ACE_Asynch_Result_Impl> safe_asynch_timer (asynch_timer);
std::unique_ptr<ACE_Asynch_Result_Impl> safe_asynch_timer (asynch_timer);
// Post a completion.
if (-1 == safe_asynch_timer->post_completion

View File

@@ -580,7 +580,7 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
// Create a new thread running <func>. *Must* be called with the
// <lock_> held...
// Get a "new" Thread Descriptor from the freelist.
auto_ptr<ACE_Thread_Descriptor> new_thr_desc (this->thread_desc_freelist_.remove ());
std::unique_ptr<ACE_Thread_Descriptor> new_thr_desc (this->thread_desc_freelist_.remove ());
// Reset thread descriptor status
new_thr_desc->reset (this);
@@ -607,7 +607,7 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func,
flags),
-1);
# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
auto_ptr <ACE_Base_Thread_Adapter> auto_thread_args (static_cast<ACE_Base_Thread_Adapter *> (thread_args));
std::unique_ptr <ACE_Base_Thread_Adapter> auto_thread_args (static_cast<ACE_Base_Thread_Adapter *> (thread_args));
ACE_TRACE ("ACE_Thread_Manager::spawn_i");
ACE_hthread_t thr_handle;

View File

@@ -1384,7 +1384,7 @@ ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle,
long new_network_events = 0;
bool delete_event = false;
auto_ptr <ACE_Auto_Event> event;
std::unique_ptr <ACE_Auto_Event> event;
// Look up the repository to see if the <event_handler> is already
// there.
@@ -1403,8 +1403,8 @@ ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle,
{
// Note: don't change this since some C++ compilers have
// <auto_ptr>s that don't work properly...
auto_ptr<ACE_Auto_Event> tmp (new ACE_Auto_Event);
event = tmp;
std::unique_ptr<ACE_Auto_Event> tmp (new ACE_Auto_Event);
event = std::move(tmp);
event_handle = event->handle ();
delete_event = true;
}

View File

@@ -83,7 +83,7 @@ namespace XML
private:
bool initialized_;
XERCES_CPP_NAMESPACE::DOMImplementation *impl_;
mutable std::auto_ptr<XERCES_CPP_NAMESPACE::XercesDOMParser> parser_;
mutable std::unique_ptr<XERCES_CPP_NAMESPACE::XercesDOMParser> parser_;
Resolver *resolver_;
bool release_resolver_;

View File

@@ -310,13 +310,13 @@ namespace XML
serializer->release ();
return retn;
#else
std::auto_ptr <XERCES_CPP_NAMESPACE::DOMWriter> writer (impl_->createDOMWriter());
std::unique_ptr <XERCES_CPP_NAMESPACE::DOMWriter> writer (impl_->createDOMWriter());
if (writer->canSetFeature (XMLUni::fgDOMWRTFormatPrettyPrint,
true))
writer->setFeature (XMLUni::fgDOMWRTFormatPrettyPrint, true);
std::auto_ptr <xercesc::XMLFormatTarget> ft (new xercesc::LocalFileFormatTarget(ACE_TEXT_ALWAYS_CHAR (file)));
std::unique_ptr <xercesc::XMLFormatTarget> ft (new xercesc::LocalFileFormatTarget(ACE_TEXT_ALWAYS_CHAR (file)));
retn = writer->writeNode(ft.get (), *doc);
return retn;

View File

@@ -149,7 +149,7 @@ namespace XSCRT
{
if (map_.get () == 0)
{
map_ = std::auto_ptr<Map_> (new Map_);
map_ = std::unique_ptr<Map_> (new Map_);
}
if (!map_->insert (
@@ -255,7 +255,7 @@ namespace XSCRT
std::map<IdentityProvider const*, Type*, IdentityComparator>
Map_;
std::auto_ptr<Map_> map_;
std::unique_ptr<Map_> map_;
};
// Fundamental types template.