DPC++ Runtime
Runtime libraries for oneAPI DPC++
stl.hpp
Go to the documentation of this file.
1 //==----------- stl.hpp - basic STL implementation -------------------------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
10 
11 // 4.5 C++ Standard library classes required for the interface
12 
13 #include <memory> // for unique_ptr
14 #include <utility> // for forward
15 
16 namespace sycl {
17 inline namespace _V1 {
18 
19 #if defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__)
20 // SYCL library is designed such a way that STL objects cross DLL boundary,
21 // which is guaranteed to work properly only when the application uses the same
22 // C++ runtime that SYCL library uses.
23 // The appplications using sycl.dll must be linked with dynamic/release C++ MSVC
24 // runtime, i.e. be compiled with /MD switch. Similarly, the applications using
25 // sycld.dll must be linked with dynamic/debug C++ runtime and be compiled with
26 // /MDd switch.
27 // Compiler automatically adds /MD or /MDd when -fsycl switch is used.
28 // The options /MD and /MDd that make the code to use dynamic runtime also
29 // define the _DLL macro.
30 #if defined(_MSC_VER)
31 #pragma message( \
32  "SYCL library is designed to work safely with dynamic C++ runtime." \
33  "Please use /MD switch with sycl.dll, /MDd switch with sycld.dll, " \
34  "or -fsycl switch to set C++ runtime automatically.")
35 #else
36 #warning "SYCL library is designed to work safely with dynamic C++ runtime."\
37  "Please use /MD switch with sycl.dll, /MDd switch with sycld.dll, "\
38  "or -fsycl switch to set C++ runtime automatically."
39 #endif
40 #endif // defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__)
41 
42 template <typename T, typename... ArgsT>
43 std::unique_ptr<T> make_unique_ptr(ArgsT &&...Args) {
44  return std::unique_ptr<T>(new T(std::forward<ArgsT>(Args)...));
45 }
46 
47 } // namespace _V1
48 } // namespace sycl
std::unique_ptr< T > make_unique_ptr(ArgsT &&...Args)
Definition: stl.hpp:43
Definition: access.hpp:18