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 <sycl/bit_cast.hpp>
14 #include <sycl/detail/defines.hpp>
15 #include <sycl/sycl_span.hpp>
16 
17 #include <exception>
18 #include <functional>
19 #include <memory>
20 #include <mutex>
21 #include <string>
22 #include <string_view>
23 #include <vector>
24 
25 namespace sycl {
27 
28 #if defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__)
29 // SYCL library is designed such a way that STL objects cross DLL boundary,
30 // which is guaranteed to work properly only when the application uses the same
31 // C++ runtime that SYCL library uses.
32 // The appplications using sycl.dll must be linked with dynamic/release C++ MSVC
33 // runtime, i.e. be compiled with /MD switch. Similarly, the applications using
34 // sycld.dll must be linked with dynamic/debug C++ runtime and be compiled with
35 // /MDd switch.
36 // Compiler automatically adds /MD or /MDd when -fsycl switch is used.
37 // The options /MD and /MDd that make the code to use dynamic runtime also
38 // define the _DLL macro.
39 #if defined(_MSC_VER)
40 #pragma message( \
41  "SYCL library is designed to work safely with dynamic C++ runtime." \
42  "Please use /MD switch with sycl.dll, /MDd switch with sycld.dll, " \
43  "or -fsycl switch to set C++ runtime automatically.")
44 #else
45 #warning "SYCL library is designed to work safely with dynamic C++ runtime."\
46  "Please use /MD switch with sycl.dll, /MDd switch with sycld.dll, "\
47  "or -fsycl switch to set C++ runtime automatically."
48 #endif
49 #endif // defined(_WIN32) && !defined(_DLL) && !defined(__SYCL_DEVICE_ONLY__)
50 
51 template <typename T, typename... ArgsT>
52 std::unique_ptr<T> make_unique_ptr(ArgsT &&...Args) {
53  return std::unique_ptr<T>(new T(std::forward<ArgsT>(Args)...));
54 }
55 
56 } // __SYCL_INLINE_VER_NAMESPACE(_V1)
57 } // namespace sycl
#define __SYCL_INLINE_VER_NAMESPACE(X)
std::unique_ptr< T > make_unique_ptr(ArgsT &&...Args)
Definition: stl.hpp:52
---— Error handling, matching OpenCL plugin semantics.
Definition: access.hpp:14