trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bc...@apache.org
Subject [trafficserver] branch master updated: Added std::make_unique for C++11
Date Wed, 04 Oct 2017 21:22:17 GMT
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new ed6dda0  Added std::make_unique for C++11
ed6dda0 is described below

commit ed6dda01e5ab0f87bae96c1014066c950a2bfad4
Author: Bryan Call <bcall@apache.org>
AuthorDate: Tue Oct 3 17:17:41 2017 -0700

    Added std::make_unique for C++11
    
    (cherry picked from commit c4c3bd9c213b63d03108653761be90f52ac55c33)
---
 lib/ts/Makefile.am      |  1 +
 lib/ts/ink_memory.h     |  4 ++++
 lib/ts/ink_std_compat.h | 37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 42 insertions(+)

diff --git a/lib/ts/Makefile.am b/lib/ts/Makefile.am
index 9a1cdc8..efd87d5 100644
--- a/lib/ts/Makefile.am
+++ b/lib/ts/Makefile.am
@@ -132,6 +132,7 @@ libtsutil_la_SOURCES = \
   ink_sock.h \
   ink_sprintf.cc \
   ink_sprintf.h \
+	ink_std_compat.h \
   ink_stack_trace.cc \
   ink_stack_trace.h \
   ink_string.cc \
diff --git a/lib/ts/ink_memory.h b/lib/ts/ink_memory.h
index f8aa037..cd4c7a1 100644
--- a/lib/ts/ink_memory.h
+++ b/lib/ts/ink_memory.h
@@ -32,6 +32,10 @@
 #include "ts/string_view.h"
 #include "ts/ink_config.h"
 
+#ifdef __cplusplus
+#include "ink_std_compat.h"
+#endif
+
 #if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
diff --git a/lib/ts/ink_std_compat.h b/lib/ts/ink_std_compat.h
new file mode 100644
index 0000000..ca972a6
--- /dev/null
+++ b/lib/ts/ink_std_compat.h
@@ -0,0 +1,37 @@
+/** @file
+
+  Compatibility with future versions of the C++ standard library
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#pragma once
+
+#if __cplusplus < 201402L
+#include <memory>
+namespace std
+{
+template <typename T, typename... Args>
+std::unique_ptr<T>
+make_unique(Args &&... args)
+{
+  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+}
+}
+#endif

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Mime
View raw message