This is an automated email from the ASF dual-hosted git repository. bcall pushed a commit to branch quic-latest in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit c4c3bd9c213b63d03108653761be90f52ac55c33 Author: Bryan Call <[email protected]> AuthorDate: Tue Oct 3 17:17:41 2017 -0700 Added std::make_unique for C++11 --- 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 737dbfe..449e03b 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 5a8e2d3..0264f77 100644 --- a/lib/ts/ink_memory.h +++ b/lib/ts/ink_memory.h @@ -30,6 +30,10 @@ #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 "[email protected]" <[email protected]>.
