Improving the backward compatibility workaround for older compilers.
This is required for GCC 5.x which does not include any auto_ptr support
or compatibility at all.
This does apply for 3.5 where C++11 support is still optional, since it
is the portability definition to allow patch back-ports.
AC_MSG_RESULT(yes)], [
HAVE_UNIQUE_PTR=no
AC_MSG_RESULT(no)])
+ if test "x$HAVE_UNIQUE_PTR" = xno; then
+ AC_DEFINE(unique_ptr, auto_ptr, [Leave undefined if std::unique_ptr<T> is supported])
+ fi
if test "x$HAVE_UNIQUE_PTR" = xyes; then
AC_DEFINE(HAVE_UNIQUE_PTR, 1, [Define to 1 if std::unique_ptr<T> is supported])
fi
// TODO: make configurable or compute from squid.conf settings if possible
static const int QueueCapacity = 1024;
-std::auto_ptr<CollapsedForwarding::Queue> CollapsedForwarding::queue;
+std::unique_ptr<CollapsedForwarding::Queue> CollapsedForwarding::queue;
/// IPC queue message
class CollapsedForwardingMsg
private:
typedef Ipc::MultiQueue Queue;
- static std::auto_ptr<Queue> queue; ///< IPC queue
+ static std::unique_ptr<Queue> queue; ///< IPC queue
};
#endif /* SQUID_COLLAPSED_FORWARDING_H */
const double IpcIoFile::Timeout = 7; // seconds; XXX: ALL,9 may require more
IpcIoFile::IpcIoFileList IpcIoFile::WaitingForOpen;
IpcIoFile::IpcIoFilesMap IpcIoFile::IpcIoFiles;
-std::auto_ptr<IpcIoFile::Queue> IpcIoFile::queue;
+std::unique_ptr<IpcIoFile::Queue> IpcIoFile::queue;
bool IpcIoFile::DiskerHandleMoreRequestsScheduled = false;
static IpcIoFilesMap IpcIoFiles;
typedef Ipc::FewToFewBiQueue Queue;
- static std::auto_ptr<Queue> queue; ///< IPC queue
+ static std::unique_ptr<Queue> queue; ///< IPC queue
/// whether we are waiting for an event to handle still queued I/O requests
static bool DiskerHandleMoreRequestsScheduled;
or some custom method that the job creator will call _before_ calling
AsyncJob::Start():
- std::auto_ptr<MyJob> job(new MyJob(...)); // sync/blocking
+ std::unique_ptr<MyJob> job(new MyJob(...)); // sync/blocking
job->prepare(...); // sync/blocking
job->prepareSomethingElse(...); // sync/blocking
AsyncStart(job.release()); // non-blocking
/**
* A pointer that deletes the object it points to when the pointer's owner or
- * context is gone. Similar to std::auto_ptr but without confusing assignment
+ * context is gone. Similar to std::unique_ptr but without confusing assignment
* and with a customizable cleanup method. Prevents memory leaks in
* the presence of exceptions and processing short cuts.
*/
return false; // internal content "hits" cannot be blocked
if (const HttpReply *rep = http->storeEntry()->getReply()) {
- std::auto_ptr<ACLFilledChecklist> chl(clientAclChecklistCreate(Config.accessList.sendHit, http));
+ std::unique_ptr<ACLFilledChecklist> chl(clientAclChecklistCreate(Config.accessList.sendHit, http));
chl->reply = const_cast<HttpReply*>(rep); // ACLChecklist API bug
HTTPMSGLOCK(chl->reply);
return chl->fastCheck() != ACCESS_ALLOWED; // when in doubt, block
Must(Comm::IsConnOpen(conn));
Must(aggrAction != NULL);
-#if HAVE_UNIQUE_PTR
std::unique_ptr<MemBuf> replyBuf;
-#else
- std::auto_ptr<MemBuf> replyBuf;
-#endif
if (strands.empty()) {
LOCAL_ARRAY(char, url, MAX_URL);
snprintf(url, MAX_URL, "%s", aggrAction->command().params.httpUri.termedBuf());
HttpRequest *req = HttpRequest::CreateFromUrl(url);
ErrorState err(ERR_INVALID_URL, Http::scNotFound, req);
-#if HAVE_UNIQUE_PTR
std::unique_ptr<HttpReply> reply(err.BuildHttpReply());
-#else
- std::auto_ptr<HttpReply> reply(err.BuildHttpReply());
-#endif
replyBuf.reset(reply->pack());
} else {
-#if HAVE_UNIQUE_PTR
std::unique_ptr<HttpReply> reply(new HttpReply);
-#else
- std::auto_ptr<HttpReply> reply(new HttpReply);
-#endif
reply->setHeaders(Http::scOkay, NULL, "text/plain", -1, squid_curtime, squid_curtime);
reply->header.putStr(HDR_CONNECTION, "close"); // until we chunk response
replyBuf.reset(reply->pack());