stdshims.h 635 B

12345678910111213141516171819202122232425262728
  1. //! Shims for std:: functions that aren't available in the current C++ versions
  2. //! we target.
  3. #ifndef STDSHIMS_H
  4. #define STDSHIMS_H
  5. #include <memory>
  6. #include <utility>
  7. #if (__cplusplus >= 201402L || _MSC_VER)
  8. #ifndef _MSC_VER
  9. #warning "This file should now be removed! The functions it provides are part of the C++14 standard."
  10. #endif
  11. using std::make_unique;
  12. #else
  13. /// Shim for http://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique
  14. template<typename T, typename... Args>
  15. std::unique_ptr<T> make_unique(Args&&... args)
  16. {
  17. return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
  18. }
  19. #endif
  20. #endif // include guard