Drake
drake_compat.h
Go to the documentation of this file.
1 #pragma once
2 
8 
9 #ifndef DRAKE_DOXYGEN_CXX
10 #if __cplusplus <= 201103L // If C++11 or earlier, we need our own helpers.
11 
12 #include <iterator>
13 #include <memory>
14 #include <type_traits>
15 #include <utility>
16 
17 namespace std {
18 
21 template<typename T, typename... Args>
22 std::unique_ptr<T> make_unique(Args&&... args) {
23  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
24 }
25 
26 template<bool B, class T = void>
27 using enable_if_t = typename enable_if<B, T>::type;
28 
29 
32 template<class InputIt1, class InputIt2, class BinaryPredicate>
33 bool equal(InputIt1 first1, InputIt1 last1,
34  InputIt2 first2, InputIt2 last2,
35  BinaryPredicate p) {
36  if (std::distance(first1, last1) != std::distance(last2, first2)) {
37  return false; // Lengths differ.
38  }
39  return std::equal(first1, last1, first2, p);
40 }
41 
42 
43 } // namespace std
44 
45 #endif // version check
46 #endif // doxygen check
47 
STL namespace.