Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 37 additions & 19 deletions sycl/include/CL/sycl/stl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,52 @@
__SYCL_INLINE_NAMESPACE(cl) {
namespace sycl {

template < class T, class Alloc = std::allocator<T> >
using vector_class = std::vector<T, Alloc>;
#ifdef _WIN32
namespace detail {
// SYCL library is designed such a way that STL objects cross DLL boundary,
// which is not guaranteed to work and considered not safe in general.
// Only using same dynamic C++ runtime library for sycl[d].dll and for
// the application using sycl[d].dll is guaranteed to work properly.
inline constexpr bool isMSVCDynamicCXXRuntime() {
// The options /MD and /MDd that make the code to use dynamic runtime also
// define the _DLL macro.
#ifdef _DLL
return true;
#else
return false;
#endif
}
static_assert(isMSVCDynamicCXXRuntime(),
"SYCL library is designed to work with dynamic C++ runtime, "
"please use /MD or /MDd switches.");
} // namespace detail
#endif // _WIN32

using string_class = std::string;
template <class T, class Alloc = std::allocator<T>>
using vector_class = std::vector<T, Alloc>;

template <class Sig>
using function_class = std::function<Sig>;
using string_class = std::string;

using mutex_class = std::mutex;
template <class Sig> using function_class = std::function<Sig>;

template <class T, class Deleter = std::default_delete<T>>
using unique_ptr_class = std::unique_ptr<T, Deleter>;
using mutex_class = std::mutex;

template <class T>
using shared_ptr_class = std::shared_ptr<T>;
template <class T, class Deleter = std::default_delete<T>>
using unique_ptr_class = std::unique_ptr<T, Deleter>;

template <class T>
using weak_ptr_class = std::weak_ptr<T>;
template <class T> using shared_ptr_class = std::shared_ptr<T>;

template <class T>
using hash_class = std::hash<T>;
template <class T> using weak_ptr_class = std::weak_ptr<T>;

using exception_ptr_class = std::exception_ptr;
template <class T> using hash_class = std::hash<T>;

using exception_ptr_class = std::exception_ptr;

template <typename T, typename... ArgsT>
unique_ptr_class<T> make_unique_ptr(ArgsT &&... Args) {
return unique_ptr_class<T>(new T(std::forward<ArgsT>(Args)...));
}

template <typename T, typename... ArgsT>
unique_ptr_class<T> make_unique_ptr(ArgsT &&... Args) {
return unique_ptr_class<T>(new T(std::forward<ArgsT>(Args)...));
}
} // sycl
} // cl