NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
backports.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
28 #ifndef NDN_UTIL_BACKPORTS_HPP
29 #define NDN_UTIL_BACKPORTS_HPP
30 
31 #include "../common.hpp"
32 
33 #ifndef NDN_CXX_HAVE_STD_TO_STRING
34 #include <boost/lexical_cast.hpp>
35 #endif
36 
37 namespace ndn {
38 
39 #if __cpp_lib_make_unique
40 using std::make_unique;
41 #else
42 template<typename T, typename... Args>
43 inline unique_ptr<T>
44 make_unique(Args&&... args)
45 {
46  return unique_ptr<T>(new T(std::forward<Args>(args)...));
47 }
48 #endif // __cpp_lib_make_unique
49 
50 #ifdef NDN_CXX_HAVE_STD_TO_STRING
51 using std::to_string;
52 #else
53 template<typename V>
54 inline std::string
55 to_string(const V& v)
56 {
57  return boost::lexical_cast<std::string>(v);
58 }
59 #endif // NDN_CXX_HAVE_STD_TO_STRING
60 
61 } // namespace ndn
62 
63 #endif // NDN_UTIL_BACKPORTS_HPP
Copyright (c) 2011-2015 Regents of the University of California.
std::string to_string(const V &v)
Definition: backports.hpp:55
unique_ptr< T > make_unique(Args &&... args)
Definition: backports.hpp:44