Emulate std::to_string on platforms that do not provide it

Inspired by NFD commit ce81230b09583f9aec98a97653a047aa54fa2bef

This commit also fixes an important typo in the name of the macro
defined by the check_vector_const_iterators configure check.

Change-Id: I1b18066474145720570b5ecd6109b3f76eb262e8
Refs: #2743
diff --git a/src/util/backports.hpp b/src/util/backports.hpp
index 19b33c4..42597e9 100644
--- a/src/util/backports.hpp
+++ b/src/util/backports.hpp
@@ -30,6 +30,10 @@
 
 #include "../common.hpp"
 
+#ifndef NDN_CXX_HAVE_STD_TO_STRING
+#include <boost/lexical_cast.hpp>
+#endif
+
 namespace ndn {
 
 #if __cpp_lib_make_unique
@@ -43,6 +47,17 @@
 }
 #endif // __cpp_lib_make_unique
 
+#ifdef NDN_CXX_HAVE_STD_TO_STRING
+using std::to_string;
+#else
+template<typename V>
+inline std::string
+to_string(const V& v)
+{
+  return boost::lexical_cast<std::string>(v);
+}
+#endif // NDN_CXX_HAVE_STD_TO_STRING
+
 } // namespace ndn
 
 #endif // NDN_UTIL_BACKPORTS_HPP