make_unique.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Copyright 2014 MongoDB Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include <bsoncxx/config/prelude.hpp>
  16. #if defined(BSONCXX_POLY_USE_MNMLSTC)
  17. #if defined(MONGO_CXX_DRIVER_COMPILING) || defined(BSONCXX_POLY_USE_SYSTEM_MNMLSTC)
  18. #include <core/memory.hpp>
  19. #else
  20. #include <bsoncxx/third_party/mnmlstc/core/memory.hpp>
  21. #endif
  22. namespace bsoncxx {
  23. BSONCXX_INLINE_NAMESPACE_BEGIN
  24. namespace stdx {
  25. using ::core::make_unique;
  26. } // namespace stdx
  27. BSONCXX_INLINE_NAMESPACE_END
  28. } // namespace bsoncxx
  29. #elif defined(BSONCXX_POLY_USE_BOOST)
  30. #include <boost/smart_ptr/make_unique.hpp>
  31. namespace bsoncxx {
  32. BSONCXX_INLINE_NAMESPACE_BEGIN
  33. namespace stdx {
  34. using ::boost::make_unique;
  35. } // namespace stdx
  36. BSONCXX_INLINE_NAMESPACE_END
  37. } // namespace bsoncxx
  38. #elif __cplusplus >= 201402L
  39. #include <memory>
  40. namespace bsoncxx {
  41. BSONCXX_INLINE_NAMESPACE_BEGIN
  42. namespace stdx {
  43. using ::std::make_unique;
  44. } // namespace stdx
  45. BSONCXX_INLINE_NAMESPACE_END
  46. } // namespace bsoncxx
  47. #else
  48. #error "Cannot find a valid polyfill for make_unique"
  49. #endif
  50. #include <bsoncxx/config/postlude.hpp>