encoding: Block::insert

This commit also updates Block::erase to accept element_const_iterator

refs #2998

Change-Id: Ie09c99d14a065444b01abff72fd97a92387b9b91
diff --git a/.waf-tools/compiler-features.py b/.waf-tools/compiler-features.py
index 2500298..098e51f 100644
--- a/.waf-tools/compiler-features.py
+++ b/.waf-tools/compiler-features.py
@@ -70,6 +70,29 @@
                       features='cxx', mandatory=False):
         self.define('HAVE_CXX_OVERRIDE_FINAL', 1)
 
+VECTOR_INSERT_ERASE_CONST_ITERATOR = '''
+#include <vector>
+int
+main()
+{
+  std::vector<int> v;
+  std::vector<int>::const_iterator it = v.cbegin();
+
+  v.insert(it, 2);
+  it = v.cend() - 1;
+  v.erase(it);
+  return 0;
+}
+'''
+
+@conf
+def check_vector_const_iterators(self):
+    if self.check_cxx(msg='Checking for std::vector::insert with const_iterators',
+                      fragment=VECTOR_INSERT_ERASE_CONST_ITERATOR,
+                      features='cxx', mandatory=False):
+        self.define('NDN_CXX_HAVE_VECTOR_INSERT_ERASE_CONST_ITERATOR', 1)
+
 def configure(conf):
     conf.check_friend_typename()
     conf.check_override()
+    conf.check_vector_const_iterators()