/**
 * Copyright (c) 2016-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

#pragma once

#include <algorithm>
#include <memory>
#include <utility>

namespace std {


#if __cplusplus<201402L
// simple implementation of make_unique since C++11 doesn't have it available
// note that it doesn't work properly if T is an array type
template <typename T, typename... Args>
std::unique_ptr<T> make_unique(Args... args) {
  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
#endif
}


/**
 * Insert into the proper location in a sorted container.
 */
template <class Container, class T, class Compare>
void insert_sorted(Container& c, const T& e, Compare comp) {
  c.insert(std::lower_bound(c.begin(), c.end(), e, comp), e);
}

/**
 * Copyright (c) 2016-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

#pragma once

#include <algorithm>
#include <memory>
#include <utility>

namespace std {

#if __cplusplus<201300L
// simple implementation of make_unique since C++11 doesn't have it available
// note that it doesn't work properly if T is an array type
template <typename T, typename... Args>
std::unique_ptr<T> make_unique(Args... args) {
  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
#endif
}


/**
 * Insert into the proper location in a sorted container.
 */
template <class Container, class T, class Compare>
void insert_sorted(Container& c, const T& e, Compare comp) {
  c.insert(std::lower_bound(c.begin(), c.end(), e, comp), e);
}

Fix the `__cplusplus` gating for std::make_unique
Fix the `__cplusplus` gating for std::make_unique

Summary: Once we upgrade to gcc 4.9 and have `std::make_unique` redex chokes. Properly gate the definition of `std::make_unique` to the right compiler macro

Reviewed By: int3, satnam6502

Differential Revision: D3970944

fbshipit-source-id: 453bb43da0bfa5d3c61d38cd62cfb17b3983ce68
