diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-12-03 07:11:02 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-12-03 07:11:02 +0100 |
commit | 7af59eda13eb8dcbb14e6db71266772f5ea663e9 (patch) | |
tree | 9ec2aa93b59475c42c7e306ac8e438fff27669f2 | |
parent | 388be5f883425419ed2e8362ed425a86839aa162 (diff) |
compat: avoid namespace clashes
-rw-r--r-- | compat/make-unique.hpp | 9 | ||||
-rw-r--r-- | compat/util.hpp | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/compat/make-unique.hpp b/compat/make-unique.hpp index bb5315c5..64c647b1 100644 --- a/compat/make-unique.hpp +++ b/compat/make-unique.hpp @@ -8,7 +8,7 @@ #include <utility> #include <cstddef> -namespace detail { +namespace raii_detail { template<class T> struct Unique_if { typedef std::unique_ptr<T> Single_object; @@ -26,18 +26,19 @@ template<class T, size_t N> struct Unique_if<T[N]> } template<class T, class... Args> - typename detail::Unique_if<T>::Single_object + typename ::raii_detail::Unique_if<T>::Single_object make_unique(Args&&... args) { return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); } template<class T> - typename detail::Unique_if<T>::Unknown_bound + typename ::raii_detail::Unique_if<T>::Unknown_bound make_unique(std::size_t n) { typedef typename std::remove_extent<T>::type U; return std::unique_ptr<T>(new U[n]()); } template<class T, class... Args> - typename detail::Unique_if<T>::Known_bound + typename ::raii_detail::Unique_if<T>::Known_bound make_unique(Args&&...) = delete; + diff --git a/compat/util.hpp b/compat/util.hpp index 7a6858a3..a63e245f 100644 --- a/compat/util.hpp +++ b/compat/util.hpp @@ -22,7 +22,7 @@ int iround(const t& val) return int(std::round(val)); } -namespace detail { +namespace util_detail { template<typename n> inline auto clamp_(n val, n min, n max) -> n @@ -39,5 +39,5 @@ inline auto clamp_(n val, n min, n max) -> n template<typename t, typename u, typename w> inline auto clamp(const t& val, const u& min, const w& max) -> decltype(val * min * max) { - return ::detail::clamp_<decltype(val * min * max)>(val, min, max); + return ::util_detail::clamp_<decltype(val * min * max)>(val, min, max); } |