Improve and simplify code with modern C++ features
Change-Id: I28d84df3087492ab2ecbeb91169a2cde12c9e31e
diff --git a/src/security/pib/certificate-container.hpp b/src/security/pib/certificate-container.hpp
index cc1798a..1fb1c63 100644
--- a/src/security/pib/certificate-container.hpp
+++ b/src/security/pib/certificate-container.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,6 +24,7 @@
#include "../v2/certificate.hpp"
+#include <iterator>
#include <set>
#include <unordered_map>
@@ -46,9 +47,15 @@
class CertificateContainer : noncopyable
{
public:
- class const_iterator : public std::iterator<std::forward_iterator_tag, const v2::Certificate>
+ class const_iterator
{
public:
+ using iterator_category = std::forward_iterator_tag;
+ using value_type = const v2::Certificate;
+ using difference_type = std::ptrdiff_t;
+ using pointer = value_type*;
+ using reference = value_type&;
+
const_iterator();
v2::Certificate
diff --git a/src/security/pib/identity-container.hpp b/src/security/pib/identity-container.hpp
index 9e45cf9..24bd5c3 100644
--- a/src/security/pib/identity-container.hpp
+++ b/src/security/pib/identity-container.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,6 +24,7 @@
#include "identity.hpp"
+#include <iterator>
#include <set>
#include <unordered_map>
@@ -46,9 +47,15 @@
class IdentityContainer : noncopyable
{
public:
- class const_iterator : public std::iterator<std::forward_iterator_tag, const Identity>
+ class const_iterator
{
public:
+ using iterator_category = std::forward_iterator_tag;
+ using value_type = const Identity;
+ using difference_type = std::ptrdiff_t;
+ using pointer = value_type*;
+ using reference = value_type&;
+
const_iterator();
Identity
diff --git a/src/security/pib/key-container.hpp b/src/security/pib/key-container.hpp
index 55a799e..6475cd2 100644
--- a/src/security/pib/key-container.hpp
+++ b/src/security/pib/key-container.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,6 +24,7 @@
#include "key.hpp"
+#include <iterator>
#include <set>
#include <unordered_map>
@@ -47,9 +48,15 @@
class KeyContainer : noncopyable
{
public:
- class const_iterator : public std::iterator<std::forward_iterator_tag, const Key>
+ class const_iterator
{
public:
+ using iterator_category = std::forward_iterator_tag;
+ using value_type = const Key;
+ using difference_type = std::ptrdiff_t;
+ using pointer = value_type*;
+ using reference = value_type&;
+
const_iterator();
Key