#ifndef MBGL_UTIL_STD #define MBGL_UTIL_STD #include #include #include namespace mbgl { namespace util { // C++14 backfill based on http://llvm.org/svn/llvm-project/libcxx/trunk/include/memory namespace detail { template struct unique_type { typedef ::std::unique_ptr single; }; template struct unique_type { typedef ::std::unique_ptr unknown_bound; }; template struct unique_type { typedef void known_bound; }; } template typename detail::unique_type::single make_unique(Args&&... args) { return ::std::unique_ptr(new T(::std::forward(args)...)); } template typename detail::unique_type::unknown_bound make_unique(size_t size) { return ::std::unique_ptr(new typename ::std::remove_extent::type[size]()); } template typename detail::unique_type::known_bound make_unique(Args&&...) = delete; template void erase_if(Container &container, ForwardIterator it, const ForwardIterator end, Predicate pred) { while (it != end) { if (pred(*it)) { container.erase(it++); } else { ++it; } } } template void erase_if(Container &container, Predicate pred) { erase_if(container, container.begin(), container.end(), pred); } } } #endif