util: remove ndn::optional, use std::optional directly

Change-Id: I503e8f250e80e0ff7708070effc2e84e3b38b3b7
diff --git a/COPYING.md b/COPYING.md
index 9c4cb03..084ab1f 100644
--- a/COPYING.md
+++ b/COPYING.md
@@ -9,9 +9,6 @@
 - OpenSSL is licensed under the
   [Apache License 2.0](https://www.openssl.org/source/license.html)
 
-- optional-lite by Martin Moene is licensed under the
-  [Boost Software License 1.0](https://github.com/martinmoene/optional-lite/blob/master/LICENSE.txt)
-
 - scope-lite by Martin Moene is licensed under the
   [Boost Software License 1.0](https://github.com/martinmoene/scope-lite/blob/master/LICENSE.txt)
 
diff --git a/ndn-cxx/data.cpp b/ndn-cxx/data.cpp
index 5997e1a..3c55384 100644
--- a/ndn-cxx/data.cpp
+++ b/ndn-cxx/data.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -351,7 +351,7 @@
 }
 
 Data&
-Data::setFinalBlock(optional<name::Component> finalBlockId)
+Data::setFinalBlock(std::optional<name::Component> finalBlockId)
 {
   if (finalBlockId != m_metaInfo.getFinalBlock()) {
     m_metaInfo.setFinalBlock(std::move(finalBlockId));
diff --git a/ndn-cxx/data.hpp b/ndn-cxx/data.hpp
index 57e0c9a..5467e49 100644
--- a/ndn-cxx/data.hpp
+++ b/ndn-cxx/data.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -299,14 +299,14 @@
   Data&
   setFreshnessPeriod(time::milliseconds freshnessPeriod);
 
-  const optional<name::Component>&
+  const std::optional<name::Component>&
   getFinalBlock() const
   {
     return m_metaInfo.getFinalBlock();
   }
 
   Data&
-  setFinalBlock(optional<name::Component> finalBlockId);
+  setFinalBlock(std::optional<name::Component> finalBlockId);
 
 public: // SignatureInfo fields
   /**
@@ -322,10 +322,13 @@
   /**
    * @brief Get the `KeyLocator` element.
    */
-  optional<KeyLocator>
+  std::optional<KeyLocator>
   getKeyLocator() const noexcept
   {
-    return m_signatureInfo.hasKeyLocator() ? make_optional(m_signatureInfo.getKeyLocator()) : nullopt;
+    if (m_signatureInfo.hasKeyLocator()) {
+      return m_signatureInfo.getKeyLocator();
+    }
+    return std::nullopt;
   }
 
 protected:
diff --git a/ndn-cxx/detail/common.hpp b/ndn-cxx/detail/common.hpp
index c64e4d8..0e2b4d4 100644
--- a/ndn-cxx/detail/common.hpp
+++ b/ndn-cxx/detail/common.hpp
@@ -54,7 +54,6 @@
 #include <cstdint>
 #include <functional>
 #include <iosfwd>
-#include <limits>
 #include <memory>
 #include <stdexcept>
 #include <string>
diff --git a/ndn-cxx/detail/nonstd/optional-lite.hpp b/ndn-cxx/detail/nonstd/optional-lite.hpp
deleted file mode 100644
index cc30bf5..0000000
--- a/ndn-cxx/detail/nonstd/optional-lite.hpp
+++ /dev/null
@@ -1,1847 +0,0 @@
-//
-// Copyright (c) 2014-2021 Martin Moene
-//
-// https://github.com/martinmoene/optional-lite
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#pragma once
-
-#ifndef NONSTD_OPTIONAL_LITE_HPP
-#define NONSTD_OPTIONAL_LITE_HPP
-
-#define optional_lite_MAJOR  3
-#define optional_lite_MINOR  5
-#define optional_lite_PATCH  0
-
-#define optional_lite_VERSION  optional_STRINGIFY(optional_lite_MAJOR) "." optional_STRINGIFY(optional_lite_MINOR) "." optional_STRINGIFY(optional_lite_PATCH)
-
-#define optional_STRINGIFY(  x )  optional_STRINGIFY_( x )
-#define optional_STRINGIFY_( x )  #x
-
-// optional-lite configuration:
-
-#define optional_OPTIONAL_DEFAULT  0
-#define optional_OPTIONAL_NONSTD   1
-#define optional_OPTIONAL_STD      2
-
-// tweak header support:
-
-#ifdef __has_include
-# if __has_include(<nonstd/optional.tweak.hpp>)
-#  include <nonstd/optional.tweak.hpp>
-# endif
-#define optional_HAVE_TWEAK_HEADER  1
-#else
-#define optional_HAVE_TWEAK_HEADER  0
-//# pragma message("optional.hpp: Note: Tweak header not supported.")
-#endif
-
-// optional selection and configuration:
-
-#if !defined( optional_CONFIG_SELECT_OPTIONAL )
-# define optional_CONFIG_SELECT_OPTIONAL  ( optional_HAVE_STD_OPTIONAL ? optional_OPTIONAL_STD : optional_OPTIONAL_NONSTD )
-#endif
-
-// Control presence of extensions:
-
-#ifndef optional_CONFIG_NO_EXTENSIONS
-#define optional_CONFIG_NO_EXTENSIONS  0
-#endif
-
-// Control presence of exception handling (try and auto discover):
-
-#ifndef optional_CONFIG_NO_EXCEPTIONS
-# if defined(_MSC_VER)
-# include <cstddef>     // for _HAS_EXCEPTIONS
-# endif
-# if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || (defined(_HAS_EXCEPTIONS) && (_HAS_EXCEPTIONS))
-#  define optional_CONFIG_NO_EXCEPTIONS  0
-# else
-#  define optional_CONFIG_NO_EXCEPTIONS  1
-# endif
-#endif
-
-// C++ language version detection (C++23 is speculative):
-// Note: VC14.0/1900 (VS2015) lacks too much from C++14.
-
-#ifndef   optional_CPLUSPLUS
-# if defined(_MSVC_LANG ) && !defined(__clang__)
-#  define optional_CPLUSPLUS  (_MSC_VER == 1900 ? 201103L : _MSVC_LANG )
-# else
-#  define optional_CPLUSPLUS  __cplusplus
-# endif
-#endif
-
-#define optional_CPP98_OR_GREATER  ( optional_CPLUSPLUS >= 199711L )
-#define optional_CPP11_OR_GREATER  ( optional_CPLUSPLUS >= 201103L )
-#define optional_CPP11_OR_GREATER_ ( optional_CPLUSPLUS >= 201103L )
-#define optional_CPP14_OR_GREATER  ( optional_CPLUSPLUS >= 201402L )
-#define optional_CPP17_OR_GREATER  ( optional_CPLUSPLUS >= 201703L )
-#define optional_CPP20_OR_GREATER  ( optional_CPLUSPLUS >= 202002L )
-#define optional_CPP23_OR_GREATER  ( optional_CPLUSPLUS >= 202300L )
-
-// C++ language version (represent 98 as 3):
-
-#define optional_CPLUSPLUS_V  ( optional_CPLUSPLUS / 100 - (optional_CPLUSPLUS > 200000 ? 2000 : 1994) )
-
-// Use C++17 std::optional if available and requested:
-
-#if optional_CPP17_OR_GREATER && defined(__has_include )
-# if __has_include( <optional> )
-#  define optional_HAVE_STD_OPTIONAL  1
-# else
-#  define optional_HAVE_STD_OPTIONAL  0
-# endif
-#else
-# define  optional_HAVE_STD_OPTIONAL  0
-#endif
-
-#define optional_USES_STD_OPTIONAL  ( (optional_CONFIG_SELECT_OPTIONAL == optional_OPTIONAL_STD) || ((optional_CONFIG_SELECT_OPTIONAL == optional_OPTIONAL_DEFAULT) && optional_HAVE_STD_OPTIONAL) )
-
-//
-// in_place: code duplicated in any-lite, expected-lite, optional-lite, value-ptr-lite, variant-lite:
-//
-
-#ifndef nonstd_lite_HAVE_IN_PLACE_TYPES
-#define nonstd_lite_HAVE_IN_PLACE_TYPES  1
-
-// C++17 std::in_place in <utility>:
-
-#if optional_CPP17_OR_GREATER
-
-#include <utility>
-
-namespace nonstd {
-
-using std::in_place;
-using std::in_place_type;
-using std::in_place_index;
-using std::in_place_t;
-using std::in_place_type_t;
-using std::in_place_index_t;
-
-#define nonstd_lite_in_place_t(      T)  std::in_place_t
-#define nonstd_lite_in_place_type_t( T)  std::in_place_type_t<T>
-#define nonstd_lite_in_place_index_t(K)  std::in_place_index_t<K>
-
-#define nonstd_lite_in_place(      T)    std::in_place_t{}
-#define nonstd_lite_in_place_type( T)    std::in_place_type_t<T>{}
-#define nonstd_lite_in_place_index(K)    std::in_place_index_t<K>{}
-
-} // namespace nonstd
-
-#else // optional_CPP17_OR_GREATER
-
-#include <cstddef>
-
-namespace nonstd {
-namespace detail {
-
-template< class T >
-struct in_place_type_tag {};
-
-template< std::size_t K >
-struct in_place_index_tag {};
-
-} // namespace detail
-
-struct in_place_t {};
-
-template< class T >
-inline in_place_t in_place( detail::in_place_type_tag<T> /*unused*/ = detail::in_place_type_tag<T>() )
-{
-    return in_place_t();
-}
-
-template< std::size_t K >
-inline in_place_t in_place( detail::in_place_index_tag<K> /*unused*/ = detail::in_place_index_tag<K>() )
-{
-    return in_place_t();
-}
-
-template< class T >
-inline in_place_t in_place_type( detail::in_place_type_tag<T> /*unused*/ = detail::in_place_type_tag<T>() )
-{
-    return in_place_t();
-}
-
-template< std::size_t K >
-inline in_place_t in_place_index( detail::in_place_index_tag<K> /*unused*/ = detail::in_place_index_tag<K>() )
-{
-    return in_place_t();
-}
-
-// mimic templated typedef:
-
-#define nonstd_lite_in_place_t(      T)  nonstd::in_place_t(&)( nonstd::detail::in_place_type_tag<T>  )
-#define nonstd_lite_in_place_type_t( T)  nonstd::in_place_t(&)( nonstd::detail::in_place_type_tag<T>  )
-#define nonstd_lite_in_place_index_t(K)  nonstd::in_place_t(&)( nonstd::detail::in_place_index_tag<K> )
-
-#define nonstd_lite_in_place(      T)    nonstd::in_place_type<T>
-#define nonstd_lite_in_place_type( T)    nonstd::in_place_type<T>
-#define nonstd_lite_in_place_index(K)    nonstd::in_place_index<K>
-
-} // namespace nonstd
-
-#endif // optional_CPP17_OR_GREATER
-#endif // nonstd_lite_HAVE_IN_PLACE_TYPES
-
-//
-// Using std::optional:
-//
-
-#if optional_USES_STD_OPTIONAL
-
-#include <optional>
-
-namespace nonstd {
-
-    using std::optional;
-    using std::bad_optional_access;
-    using std::hash;
-
-    using std::nullopt;
-    using std::nullopt_t;
-
-    using std::operator==;
-    using std::operator!=;
-    using std::operator<;
-    using std::operator<=;
-    using std::operator>;
-    using std::operator>=;
-    using std::make_optional;
-    using std::swap;
-}
-
-#else // optional_USES_STD_OPTIONAL
-
-#include <cassert>
-#include <utility>
-
-// optional-lite alignment configuration:
-
-#ifndef  optional_CONFIG_MAX_ALIGN_HACK
-# define optional_CONFIG_MAX_ALIGN_HACK  0
-#endif
-
-#ifndef  optional_CONFIG_ALIGN_AS
-// no default, used in #if defined()
-#endif
-
-#ifndef  optional_CONFIG_ALIGN_AS_FALLBACK
-# define optional_CONFIG_ALIGN_AS_FALLBACK  double
-#endif
-
-// Compiler warning suppression:
-
-#if defined(__clang__)
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wundef"
-#elif defined(__GNUC__)
-# pragma GCC   diagnostic push
-# pragma GCC   diagnostic ignored "-Wundef"
-#elif defined(_MSC_VER )
-# pragma warning( push )
-#endif
-
-// half-open range [lo..hi):
-#define optional_BETWEEN( v, lo, hi ) ( (lo) <= (v) && (v) < (hi) )
-
-// Compiler versions:
-//
-// MSVC++  6.0  _MSC_VER == 1200  optional_COMPILER_MSVC_VERSION ==  60  (Visual Studio 6.0)
-// MSVC++  7.0  _MSC_VER == 1300  optional_COMPILER_MSVC_VERSION ==  70  (Visual Studio .NET 2002)
-// MSVC++  7.1  _MSC_VER == 1310  optional_COMPILER_MSVC_VERSION ==  71  (Visual Studio .NET 2003)
-// MSVC++  8.0  _MSC_VER == 1400  optional_COMPILER_MSVC_VERSION ==  80  (Visual Studio 2005)
-// MSVC++  9.0  _MSC_VER == 1500  optional_COMPILER_MSVC_VERSION ==  90  (Visual Studio 2008)
-// MSVC++ 10.0  _MSC_VER == 1600  optional_COMPILER_MSVC_VERSION == 100  (Visual Studio 2010)
-// MSVC++ 11.0  _MSC_VER == 1700  optional_COMPILER_MSVC_VERSION == 110  (Visual Studio 2012)
-// MSVC++ 12.0  _MSC_VER == 1800  optional_COMPILER_MSVC_VERSION == 120  (Visual Studio 2013)
-// MSVC++ 14.0  _MSC_VER == 1900  optional_COMPILER_MSVC_VERSION == 140  (Visual Studio 2015)
-// MSVC++ 14.1  _MSC_VER >= 1910  optional_COMPILER_MSVC_VERSION == 141  (Visual Studio 2017)
-// MSVC++ 14.2  _MSC_VER >= 1920  optional_COMPILER_MSVC_VERSION == 142  (Visual Studio 2019)
-
-#if defined(_MSC_VER ) && !defined(__clang__)
-# define optional_COMPILER_MSVC_VER      (_MSC_VER )
-# define optional_COMPILER_MSVC_VERSION  (_MSC_VER / 10 - 10 * ( 5 + (_MSC_VER < 1900 ) ) )
-#else
-# define optional_COMPILER_MSVC_VER      0
-# define optional_COMPILER_MSVC_VERSION  0
-#endif
-
-#define optional_COMPILER_VERSION( major, minor, patch )  ( 10 * (10 * (major) + (minor) ) + (patch) )
-
-#if defined(__GNUC__) && !defined(__clang__)
-# define optional_COMPILER_GNUC_VERSION   optional_COMPILER_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
-#else
-# define optional_COMPILER_GNUC_VERSION   0
-#endif
-
-#if defined(__clang__)
-# define optional_COMPILER_CLANG_VERSION  optional_COMPILER_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
-#else
-# define optional_COMPILER_CLANG_VERSION  0
-#endif
-
-#if optional_BETWEEN(optional_COMPILER_MSVC_VERSION, 70, 140 )
-# pragma warning( disable: 4345 )   // initialization behavior changed
-#endif
-
-#if optional_BETWEEN(optional_COMPILER_MSVC_VERSION, 70, 150 )
-# pragma warning( disable: 4814 )   // in C++14 'constexpr' will not imply 'const'
-#endif
-
-// Presence of language and library features:
-
-#define optional_HAVE(FEATURE) ( optional_HAVE_##FEATURE )
-
-#ifdef _HAS_CPP0X
-# define optional_HAS_CPP0X  _HAS_CPP0X
-#else
-# define optional_HAS_CPP0X  0
-#endif
-
-// Unless defined otherwise below, consider VC14 as C++11 for optional-lite:
-
-#if optional_COMPILER_MSVC_VER >= 1900
-# undef  optional_CPP11_OR_GREATER
-# define optional_CPP11_OR_GREATER  1
-#endif
-
-#define optional_CPP11_90   (optional_CPP11_OR_GREATER_ || optional_COMPILER_MSVC_VER >= 1500)
-#define optional_CPP11_100  (optional_CPP11_OR_GREATER_ || optional_COMPILER_MSVC_VER >= 1600)
-#define optional_CPP11_110  (optional_CPP11_OR_GREATER_ || optional_COMPILER_MSVC_VER >= 1700)
-#define optional_CPP11_120  (optional_CPP11_OR_GREATER_ || optional_COMPILER_MSVC_VER >= 1800)
-#define optional_CPP11_140  (optional_CPP11_OR_GREATER_ || optional_COMPILER_MSVC_VER >= 1900)
-#define optional_CPP11_141  (optional_CPP11_OR_GREATER_ || optional_COMPILER_MSVC_VER >= 1910)
-
-#define optional_CPP14_000  (optional_CPP14_OR_GREATER)
-#define optional_CPP17_000  (optional_CPP17_OR_GREATER)
-
-// clang >= 2.9, gcc >= 4.9, msvc >= vc14.0/1900 (vs15):
-#define optional_CPP11_140_C290_G490    ((optional_CPP11_OR_GREATER_ && (optional_COMPILER_CLANG_VERSION >= 290 || optional_COMPILER_GNUC_VERSION >= 490)) || (optional_COMPILER_MSVC_VER >= 1900))
-
-// clang >= 3.5, msvc >= vc11 (vs12):
-#define optional_CPP11_110_C350         ( optional_CPP11_110 && !optional_BETWEEN( optional_COMPILER_CLANG_VERSION, 1, 350 ) )
-
-// clang >= 3.5, gcc >= 5.0, msvc >= vc11 (vs12):
-#define optional_CPP11_110_C350_G500 \
-    (  optional_CPP11_110 && \
-    !( optional_BETWEEN( optional_COMPILER_CLANG_VERSION, 1, 350 ) \
-    || optional_BETWEEN( optional_COMPILER_GNUC_VERSION , 1, 500 ) ) )
-
-// Presence of C++11 language features:
-
-#define optional_HAVE_CONSTEXPR_11      optional_CPP11_140
-#define optional_HAVE_IS_DEFAULT        optional_CPP11_140
-#define optional_HAVE_NOEXCEPT          optional_CPP11_140
-#define optional_HAVE_NULLPTR           optional_CPP11_100
-#define optional_HAVE_REF_QUALIFIER     optional_CPP11_140_C290_G490
-#define optional_HAVE_STATIC_ASSERT     optional_CPP11_110
-#define optional_HAVE_INITIALIZER_LIST  optional_CPP11_140
-
-// Presence of C++14 language features:
-
-#define optional_HAVE_CONSTEXPR_14      optional_CPP14_000
-
-// Presence of C++17 language features:
-
-#define optional_HAVE_NODISCARD         optional_CPP17_000
-
-// Presence of C++ library features:
-
-#define optional_HAVE_CONDITIONAL       optional_CPP11_120
-#define optional_HAVE_REMOVE_CV         optional_CPP11_120
-#define optional_HAVE_TYPE_TRAITS       optional_CPP11_90
-
-#define optional_HAVE_TR1_TYPE_TRAITS   (!! optional_COMPILER_GNUC_VERSION )
-#define optional_HAVE_TR1_ADD_POINTER   (!! optional_COMPILER_GNUC_VERSION )
-
-#define optional_HAVE_IS_ASSIGNABLE                     optional_CPP11_110_C350
-#define optional_HAVE_IS_MOVE_CONSTRUCTIBLE             optional_CPP11_110_C350
-#define optional_HAVE_IS_NOTHROW_MOVE_ASSIGNABLE        optional_CPP11_110_C350
-#define optional_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE     optional_CPP11_110_C350
-#define optional_HAVE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE   optional_CPP11_110_C350_G500
-#define optional_HAVE_IS_TRIVIALLY_MOVE_CONSTRUCTIBLE   optional_CPP11_110_C350_G500
-
-// C++ feature usage:
-
-#if optional_HAVE( CONSTEXPR_11 )
-# define optional_constexpr  constexpr
-#else
-# define optional_constexpr  /*constexpr*/
-#endif
-
-#if optional_HAVE( IS_DEFAULT )
-# define optional_is_default  = default;
-#else
-# define optional_is_default  {}
-#endif
-
-#if optional_HAVE( CONSTEXPR_14 )
-# define optional_constexpr14  constexpr
-#else
-# define optional_constexpr14  /*constexpr*/
-#endif
-
-#if optional_HAVE( NODISCARD )
-# define optional_nodiscard  [[nodiscard]]
-#else
-# define optional_nodiscard  /*[[nodiscard]]*/
-#endif
-
-#if optional_HAVE( NOEXCEPT )
-# define optional_noexcept  noexcept
-#else
-# define optional_noexcept  /*noexcept*/
-#endif
-
-#if optional_HAVE( NULLPTR )
-# define optional_nullptr  nullptr
-#else
-# define optional_nullptr  NULL
-#endif
-
-#if optional_HAVE( REF_QUALIFIER )
-// NOLINTNEXTLINE( bugprone-macro-parentheses )
-# define optional_ref_qual  &
-# define optional_refref_qual  &&
-#else
-# define optional_ref_qual  /*&*/
-# define optional_refref_qual  /*&&*/
-#endif
-
-#if optional_HAVE( STATIC_ASSERT )
-# define optional_static_assert(expr, text)    static_assert(expr, text);
-#else
-# define optional_static_assert(expr, text)  /*static_assert(expr, text);*/
-#endif
-
-// additional includes:
-
-#if optional_CONFIG_NO_EXCEPTIONS
-// already included: <cassert>
-#else
-# include <stdexcept>
-#endif
-
-#if optional_CPP11_OR_GREATER
-# include <functional>
-#endif
-
-#if optional_HAVE( INITIALIZER_LIST )
-# include <initializer_list>
-#endif
-
-#if optional_HAVE( TYPE_TRAITS )
-# include <type_traits>
-#elif optional_HAVE( TR1_TYPE_TRAITS )
-# include <tr1/type_traits>
-#endif
-
-// Method enabling
-
-#if optional_CPP11_OR_GREATER
-
-#define optional_REQUIRES_0(...) \
-    template< bool B = (__VA_ARGS__), typename std::enable_if<B, int>::type = 0 >
-
-#define optional_REQUIRES_T(...) \
-    , typename std::enable_if< (__VA_ARGS__), int >::type = 0
-
-#define optional_REQUIRES_R(R, ...) \
-    typename std::enable_if< (__VA_ARGS__), R>::type
-
-#define optional_REQUIRES_A(...) \
-    , typename std::enable_if< (__VA_ARGS__), void*>::type = nullptr
-
-#endif
-
-//
-// optional:
-//
-
-namespace nonstd { namespace optional_lite {
-
-namespace std11 {
-
-template< class T, T v > struct integral_constant { enum { value = v }; };
-template< bool B       > struct bool_constant : integral_constant<bool, B>{};
-
-typedef bool_constant< true  > true_type;
-typedef bool_constant< false > false_type;
-
-#if optional_CPP11_OR_GREATER
-    using std::move;
-#else
-    template< typename T > T & move( T & t ) { return t; }
-#endif
-
-#if optional_HAVE( CONDITIONAL )
-    using std::conditional;
-#else
-    template< bool B, typename T, typename F > struct conditional              { typedef T type; };
-    template<         typename T, typename F > struct conditional<false, T, F> { typedef F type; };
-#endif // optional_HAVE_CONDITIONAL
-
-#if optional_HAVE( IS_ASSIGNABLE )
-    using std::is_assignable;
-#else
-    template< class T, class U > struct is_assignable : std11::true_type{};
-#endif
-
-#if optional_HAVE( IS_MOVE_CONSTRUCTIBLE )
-    using std::is_move_constructible;
-#else
-    template< class T > struct is_move_constructible : std11::true_type{};
-#endif
-
-#if optional_HAVE( IS_NOTHROW_MOVE_ASSIGNABLE )
-    using std::is_nothrow_move_assignable;
-#else
-    template< class T > struct is_nothrow_move_assignable : std11::true_type{};
-#endif
-
-#if optional_HAVE( IS_NOTHROW_MOVE_CONSTRUCTIBLE )
-    using std::is_nothrow_move_constructible;
-#else
-    template< class T > struct is_nothrow_move_constructible : std11::true_type{};
-#endif
-
-#if optional_HAVE( IS_TRIVIALLY_COPY_CONSTRUCTIBLE )
-    using std::is_trivially_copy_constructible;
-#else
-    template< class T > struct is_trivially_copy_constructible : std11::true_type{};
-#endif
-
-#if optional_HAVE( IS_TRIVIALLY_MOVE_CONSTRUCTIBLE )
-    using std::is_trivially_move_constructible;
-#else
-    template< class T > struct is_trivially_move_constructible : std11::true_type{};
-#endif
-
-} // namespace std11
-
-#if optional_CPP11_OR_GREATER
-
-/// type traits C++17:
-
-namespace std17 {
-
-#if optional_CPP17_OR_GREATER
-
-using std::is_swappable;
-using std::is_nothrow_swappable;
-
-#elif optional_CPP11_OR_GREATER
-
-namespace detail {
-
-using std::swap;
-
-struct is_swappable
-{
-    template< typename T, typename = decltype( swap( std::declval<T&>(), std::declval<T&>() ) ) >
-    static std11::true_type test( int /*unused*/ );
-
-    template< typename >
-    static std11::false_type test(...);
-};
-
-struct is_nothrow_swappable
-{
-    // wrap noexcept(expr) in separate function as work-around for VC140 (VS2015):
-
-    template< typename T >
-    static constexpr bool satisfies()
-    {
-        return noexcept( swap( std::declval<T&>(), std::declval<T&>() ) );
-    }
-
-    template< typename T >
-    static auto test( int /*unused*/ ) -> std11::integral_constant<bool, satisfies<T>()>{}
-
-    template< typename >
-    static auto test(...) -> std11::false_type;
-};
-
-} // namespace detail
-
-// is [nothow] swappable:
-
-template< typename T >
-struct is_swappable : decltype( detail::is_swappable::test<T>(0) ){};
-
-template< typename T >
-struct is_nothrow_swappable : decltype( detail::is_nothrow_swappable::test<T>(0) ){};
-
-#endif // optional_CPP17_OR_GREATER
-
-} // namespace std17
-
-/// type traits C++20:
-
-namespace std20 {
-
-template< typename T >
-struct remove_cvref
-{
-    typedef typename std::remove_cv< typename std::remove_reference<T>::type >::type type;
-};
-
-} // namespace std20
-
-#endif // optional_CPP11_OR_GREATER
-
-/// class optional
-
-template< typename T >
-class optional;
-
-namespace detail {
-
-// C++11 emulation:
-
-struct nulltype{};
-
-template< typename Head, typename Tail >
-struct typelist
-{
-    typedef Head head;
-    typedef Tail tail;
-};
-
-#if optional_CONFIG_MAX_ALIGN_HACK
-
-// Max align, use most restricted type for alignment:
-
-#define optional_UNIQUE(  name )       optional_UNIQUE2( name, __LINE__ )
-#define optional_UNIQUE2( name, line ) optional_UNIQUE3( name, line )
-#define optional_UNIQUE3( name, line ) name ## line
-
-#define optional_ALIGN_TYPE( type ) \
-    type optional_UNIQUE( _t ); struct_t< type > optional_UNIQUE( _st )
-
-template< typename T >
-struct struct_t { T _; };
-
-union max_align_t
-{
-    optional_ALIGN_TYPE( char );
-    optional_ALIGN_TYPE( short int );
-    optional_ALIGN_TYPE( int );
-    optional_ALIGN_TYPE( long int  );
-    optional_ALIGN_TYPE( float  );
-    optional_ALIGN_TYPE( double );
-    optional_ALIGN_TYPE( long double );
-    optional_ALIGN_TYPE( char * );
-    optional_ALIGN_TYPE( short int * );
-    optional_ALIGN_TYPE( int *  );
-    optional_ALIGN_TYPE( long int * );
-    optional_ALIGN_TYPE( float * );
-    optional_ALIGN_TYPE( double * );
-    optional_ALIGN_TYPE( long double * );
-    optional_ALIGN_TYPE( void * );
-
-#ifdef HAVE_LONG_LONG
-    optional_ALIGN_TYPE( long long );
-#endif
-
-    struct Unknown;
-
-    Unknown ( * optional_UNIQUE(_) )( Unknown );
-    Unknown * Unknown::* optional_UNIQUE(_);
-    Unknown ( Unknown::* optional_UNIQUE(_) )( Unknown );
-
-    struct_t< Unknown ( * )( Unknown)         > optional_UNIQUE(_);
-    struct_t< Unknown * Unknown::*            > optional_UNIQUE(_);
-    struct_t< Unknown ( Unknown::* )(Unknown) > optional_UNIQUE(_);
-};
-
-#undef optional_UNIQUE
-#undef optional_UNIQUE2
-#undef optional_UNIQUE3
-
-#undef optional_ALIGN_TYPE
-
-#elif defined( optional_CONFIG_ALIGN_AS ) // optional_CONFIG_MAX_ALIGN_HACK
-
-// Use user-specified type for alignment:
-
-#define optional_ALIGN_AS( unused ) \
-    optional_CONFIG_ALIGN_AS
-
-#else // optional_CONFIG_MAX_ALIGN_HACK
-
-// Determine POD type to use for alignment:
-
-#define optional_ALIGN_AS( to_align ) \
-    typename type_of_size< alignment_types, alignment_of< to_align >::value >::type
-
-template< typename T >
-struct alignment_of;
-
-template< typename T >
-struct alignment_of_hack
-{
-    char c;
-    T t;
-    alignment_of_hack();
-};
-
-template< size_t A, size_t S >
-struct alignment_logic
-{
-    enum { value = A < S ? A : S };
-};
-
-template< typename T >
-struct alignment_of
-{
-    enum { value = alignment_logic<
-        sizeof( alignment_of_hack<T> ) - sizeof(T), sizeof(T) >::value };
-};
-
-template< typename List, size_t N >
-struct type_of_size
-{
-    typedef typename std11::conditional<
-        N == sizeof( typename List::head ),
-            typename List::head,
-            typename type_of_size<typename List::tail, N >::type >::type type;
-};
-
-template< size_t N >
-struct type_of_size< nulltype, N >
-{
-    typedef optional_CONFIG_ALIGN_AS_FALLBACK type;
-};
-
-template< typename T>
-struct struct_t { T _; };
-
-#define optional_ALIGN_TYPE( type ) \
-    typelist< type , typelist< struct_t< type >
-
-struct Unknown;
-
-typedef
-    optional_ALIGN_TYPE( char ),
-    optional_ALIGN_TYPE( short ),
-    optional_ALIGN_TYPE( int ),
-    optional_ALIGN_TYPE( long ),
-    optional_ALIGN_TYPE( float ),
-    optional_ALIGN_TYPE( double ),
-    optional_ALIGN_TYPE( long double ),
-
-    optional_ALIGN_TYPE( char *),
-    optional_ALIGN_TYPE( short * ),
-    optional_ALIGN_TYPE( int * ),
-    optional_ALIGN_TYPE( long * ),
-    optional_ALIGN_TYPE( float * ),
-    optional_ALIGN_TYPE( double * ),
-    optional_ALIGN_TYPE( long double * ),
-
-    optional_ALIGN_TYPE( Unknown ( * )( Unknown ) ),
-    optional_ALIGN_TYPE( Unknown * Unknown::*     ),
-    optional_ALIGN_TYPE( Unknown ( Unknown::* )( Unknown ) ),
-
-    nulltype
-    > > > > > > >    > > > > > > >
-    > > > > > > >    > > > > > > >
-    > > > > > >
-    alignment_types;
-
-#undef optional_ALIGN_TYPE
-
-#endif // optional_CONFIG_MAX_ALIGN_HACK
-
-/// C++03 constructed union to hold value.
-
-template< typename T >
-union storage_t
-{
-//private:
-//    template< typename > friend class optional;
-
-    typedef T value_type;
-
-    storage_t() optional_is_default
-
-    explicit storage_t( value_type const & v )
-    {
-        construct_value( v );
-    }
-
-    void construct_value( value_type const & v )
-    {
-        ::new( value_ptr() ) value_type( v );
-    }
-
-#if optional_CPP11_OR_GREATER
-
-    explicit storage_t( value_type && v )
-    {
-        construct_value( std::move( v ) );
-    }
-
-    void construct_value( value_type && v )
-    {
-        ::new( value_ptr() ) value_type( std::move( v ) );
-    }
-
-    template< class... Args >
-    storage_t( nonstd_lite_in_place_t(T), Args&&... args )
-    {
-        emplace( std::forward<Args>(args)... );
-    }
-
-    template< class... Args >
-    void emplace( Args&&... args )
-    {
-        ::new( value_ptr() ) value_type( std::forward<Args>(args)... );
-    }
-
-    template< class U, class... Args >
-    void emplace( std::initializer_list<U> il, Args&&... args )
-    {
-        ::new( value_ptr() ) value_type( il, std::forward<Args>(args)... );
-    }
-
-#endif
-
-    void destruct_value()
-    {
-        value_ptr()->~T();
-    }
-
-    optional_nodiscard value_type const * value_ptr() const
-    {
-        return as<value_type>();
-    }
-
-    value_type * value_ptr()
-    {
-        return as<value_type>();
-    }
-
-    optional_nodiscard value_type const & value() const optional_ref_qual
-    {
-        return * value_ptr();
-    }
-
-    value_type & value() optional_ref_qual
-    {
-        return * value_ptr();
-    }
-
-#if optional_HAVE( REF_QUALIFIER )
-
-    optional_nodiscard value_type const && value() const optional_refref_qual
-    {
-        return std::move( value() );
-    }
-
-    value_type && value() optional_refref_qual
-    {
-        return std::move( value() );
-    }
-
-#endif
-
-#if optional_CPP11_OR_GREATER
-
-    using aligned_storage_t = typename std::aligned_storage< sizeof(value_type), alignof(value_type) >::type;
-    aligned_storage_t data;
-
-#elif optional_CONFIG_MAX_ALIGN_HACK
-
-    typedef struct { unsigned char data[ sizeof(value_type) ]; } aligned_storage_t;
-
-    max_align_t hack;
-    aligned_storage_t data;
-
-#else
-    typedef optional_ALIGN_AS(value_type) align_as_type;
-
-    typedef struct { align_as_type data[ 1 + ( sizeof(value_type) - 1 ) / sizeof(align_as_type) ]; } aligned_storage_t;
-    aligned_storage_t data;
-
-#   undef optional_ALIGN_AS
-
-#endif // optional_CONFIG_MAX_ALIGN_HACK
-
-    optional_nodiscard void * ptr() optional_noexcept
-    {
-        return &data;
-    }
-
-    optional_nodiscard void const * ptr() const optional_noexcept
-    {
-        return &data;
-    }
-
-    template <typename U>
-    optional_nodiscard U * as()
-    {
-        return reinterpret_cast<U*>( ptr() );
-    }
-
-    template <typename U>
-    optional_nodiscard U const * as() const
-    {
-        return reinterpret_cast<U const *>( ptr() );
-    }
-};
-
-} // namespace detail
-
-/// disengaged state tag
-
-struct nullopt_t
-{
-    struct init{};
-    explicit optional_constexpr nullopt_t( init /*unused*/ ) optional_noexcept {}
-};
-
-#if optional_HAVE( CONSTEXPR_11 )
-constexpr nullopt_t nullopt{ nullopt_t::init{} };
-#else
-// extra parenthesis to prevent the most vexing parse:
-const nullopt_t nullopt(( nullopt_t::init() ));
-#endif
-
-/// optional access error
-
-#if ! optional_CONFIG_NO_EXCEPTIONS
-
-class bad_optional_access : public std::logic_error
-{
-public:
-  explicit bad_optional_access()
-  : logic_error( "bad optional access" ) {}
-};
-
-#endif //optional_CONFIG_NO_EXCEPTIONS
-
-/// optional
-
-template< typename T>
-class optional
-{
-    optional_static_assert(( !std::is_same<typename std::remove_cv<T>::type, nullopt_t>::value  ),
-        "T in optional<T> must not be of type 'nullopt_t'.")
-
-    optional_static_assert(( !std::is_same<typename std::remove_cv<T>::type, in_place_t>::value ),
-        "T in optional<T> must not be of type 'in_place_t'.")
-
-    optional_static_assert(( std::is_object<T>::value && std::is_destructible<T>::value && !std::is_array<T>::value ),
-        "T in optional<T> must meet the Cpp17Destructible requirements.")
-
-private:
-    template< typename > friend class optional;
-
-    typedef void (optional::*safe_bool)() const;
-
-public:
-    typedef T value_type;
-
-     // x.x.3.1, constructors
-
-    // 1a - default construct
-    optional_constexpr optional() optional_noexcept
-    : has_value_( false )
-    , contained()
-    {}
-
-    // 1b - construct explicitly empty
-    // NOLINTNEXTLINE( google-explicit-constructor, hicpp-explicit-conversions )
-    optional_constexpr optional( nullopt_t /*unused*/ ) optional_noexcept
-    : has_value_( false )
-    , contained()
-    {}
-
-    // 2 - copy-construct
-#if optional_CPP11_OR_GREATER
-    // template< typename U = T
-    //     optional_REQUIRES_T(
-    //         std::is_copy_constructible<U>::value
-    //         || std11::is_trivially_copy_constructible<U>::value
-    //     )
-    // >
-#endif
-    optional_constexpr14 optional( optional const & other )
-    : has_value_( other.has_value() )
-    {
-        if ( other.has_value() )
-        {
-            contained.construct_value( other.contained.value() );
-        }
-    }
-
-#if optional_CPP11_OR_GREATER
-
-    // 3 (C++11) - move-construct from optional
-    template< typename U = T
-        optional_REQUIRES_T(
-            std11::is_move_constructible<U>::value
-            || std11::is_trivially_move_constructible<U>::value
-        )
-    >
-    optional_constexpr14 optional( optional && other )
-    // NOLINTNEXTLINE( performance-noexcept-move-constructor )
-        noexcept( std11::is_nothrow_move_constructible<T>::value )
-    : has_value_( other.has_value() )
-    {
-        if ( other.has_value() )
-        {
-            contained.construct_value( std::move( other.contained.value() ) );
-        }
-    }
-
-    // 4a (C++11) - explicit converting copy-construct from optional
-    template< typename U
-        optional_REQUIRES_T(
-            std::is_constructible<T, U const &>::value
-            && !std::is_constructible<T, optional<U> &          >::value
-            && !std::is_constructible<T, optional<U> &&         >::value
-            && !std::is_constructible<T, optional<U> const &    >::value
-            && !std::is_constructible<T, optional<U> const &&   >::value
-            && !std::is_convertible<     optional<U> &       , T>::value
-            && !std::is_convertible<     optional<U> &&      , T>::value
-            && !std::is_convertible<     optional<U> const & , T>::value
-            && !std::is_convertible<     optional<U> const &&, T>::value
-            && !std::is_convertible<               U const & , T>::value /*=> explicit */
-        )
-    >
-    explicit optional( optional<U> const & other )
-    : has_value_( other.has_value() )
-    {
-        if ( other.has_value() )
-        {
-            contained.construct_value( T{ other.contained.value() } );
-        }
-    }
-#endif // optional_CPP11_OR_GREATER
-
-    // 4b (C++98 and later) - non-explicit converting copy-construct from optional
-    template< typename U
-#if optional_CPP11_OR_GREATER
-        optional_REQUIRES_T(
-            std::is_constructible<T, U const &>::value
-            && !std::is_constructible<T, optional<U> &          >::value
-            && !std::is_constructible<T, optional<U> &&         >::value
-            && !std::is_constructible<T, optional<U> const &    >::value
-            && !std::is_constructible<T, optional<U> const &&   >::value
-            && !std::is_convertible<     optional<U> &       , T>::value
-            && !std::is_convertible<     optional<U> &&      , T>::value
-            && !std::is_convertible<     optional<U> const & , T>::value
-            && !std::is_convertible<     optional<U> const &&, T>::value
-            &&  std::is_convertible<               U const & , T>::value /*=> non-explicit */
-        )
-#endif // optional_CPP11_OR_GREATER
-    >
-    // NOLINTNEXTLINE( google-explicit-constructor, hicpp-explicit-conversions )
-    /*non-explicit*/ optional( optional<U> const & other )
-    : has_value_( other.has_value() )
-    {
-        if ( other.has_value() )
-        {
-            contained.construct_value( other.contained.value() );
-        }
-    }
-
-#if optional_CPP11_OR_GREATER
-
-    // 5a (C++11) - explicit converting move-construct from optional
-    template< typename U
-        optional_REQUIRES_T(
-            std::is_constructible<T, U &&>::value
-            && !std::is_constructible<T, optional<U> &          >::value
-            && !std::is_constructible<T, optional<U> &&         >::value
-            && !std::is_constructible<T, optional<U> const &    >::value
-            && !std::is_constructible<T, optional<U> const &&   >::value
-            && !std::is_convertible<     optional<U> &       , T>::value
-            && !std::is_convertible<     optional<U> &&      , T>::value
-            && !std::is_convertible<     optional<U> const & , T>::value
-            && !std::is_convertible<     optional<U> const &&, T>::value
-            && !std::is_convertible<                     U &&, T>::value /*=> explicit */
-        )
-    >
-    explicit optional( optional<U> && other
-    )
-    : has_value_( other.has_value() )
-    {
-        if ( other.has_value() )
-        {
-            contained.construct_value( T{ std::move( other.contained.value() ) } );
-        }
-    }
-
-    // 5a (C++11) - non-explicit converting move-construct from optional
-    template< typename U
-        optional_REQUIRES_T(
-            std::is_constructible<T, U &&>::value
-            && !std::is_constructible<T, optional<U> &          >::value
-            && !std::is_constructible<T, optional<U> &&         >::value
-            && !std::is_constructible<T, optional<U> const &    >::value
-            && !std::is_constructible<T, optional<U> const &&   >::value
-            && !std::is_convertible<     optional<U> &       , T>::value
-            && !std::is_convertible<     optional<U> &&      , T>::value
-            && !std::is_convertible<     optional<U> const & , T>::value
-            && !std::is_convertible<     optional<U> const &&, T>::value
-            &&  std::is_convertible<                     U &&, T>::value /*=> non-explicit */
-        )
-    >
-    // NOLINTNEXTLINE( google-explicit-constructor, hicpp-explicit-conversions )
-    /*non-explicit*/ optional( optional<U> && other )
-    : has_value_( other.has_value() )
-    {
-        if ( other.has_value() )
-        {
-            contained.construct_value( std::move( other.contained.value() ) );
-        }
-    }
-
-    // 6 (C++11) - in-place construct
-    template< typename... Args
-        optional_REQUIRES_T(
-            std::is_constructible<T, Args&&...>::value
-        )
-    >
-    optional_constexpr explicit optional( nonstd_lite_in_place_t(T), Args&&... args )
-    : has_value_( true )
-    , contained( in_place, std::forward<Args>(args)... )
-    {}
-
-    // 7 (C++11) - in-place construct,  initializer-list
-    template< typename U, typename... Args
-        optional_REQUIRES_T(
-            std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value
-        )
-    >
-    optional_constexpr explicit optional( nonstd_lite_in_place_t(T), std::initializer_list<U> il, Args&&... args )
-    : has_value_( true )
-    , contained( T( il, std::forward<Args>(args)...) )
-    {}
-
-    // 8a (C++11) - explicit move construct from value
-    template< typename U = T
-        optional_REQUIRES_T(
-            std::is_constructible<T, U&&>::value
-            && !std::is_same<typename std20::remove_cvref<U>::type, nonstd_lite_in_place_t(U)>::value
-            && !std::is_same<typename std20::remove_cvref<U>::type, optional<T>>::value
-            && !std::is_convertible<U&&, T>::value /*=> explicit */
-        )
-    >
-    optional_constexpr explicit optional( U && value )
-    : has_value_( true )
-    , contained( nonstd_lite_in_place(T), std::forward<U>( value ) )
-    {}
-
-    // 8b (C++11) - non-explicit move construct from value
-    template< typename U = T
-        optional_REQUIRES_T(
-            std::is_constructible<T, U&&>::value
-            && !std::is_same<typename std20::remove_cvref<U>::type, nonstd_lite_in_place_t(U)>::value
-            && !std::is_same<typename std20::remove_cvref<U>::type, optional<T>>::value
-            && std::is_convertible<U&&, T>::value /*=> non-explicit */
-        )
-    >
-    // NOLINTNEXTLINE( google-explicit-constructor, hicpp-explicit-conversions )
-    optional_constexpr /*non-explicit*/ optional( U && value )
-    : has_value_( true )
-    , contained( nonstd_lite_in_place(T), std::forward<U>( value ) )
-    {}
-
-#else // optional_CPP11_OR_GREATER
-
-    // 8 (C++98)
-    optional( value_type const & value )
-    : has_value_( true )
-    , contained( value )
-    {}
-
-#endif // optional_CPP11_OR_GREATER
-
-    // x.x.3.2, destructor
-
-    ~optional()
-    {
-        if ( has_value() )
-        {
-            contained.destruct_value();
-        }
-    }
-
-    // x.x.3.3, assignment
-
-    // 1 (C++98and later) -  assign explicitly empty
-    optional & operator=( nullopt_t /*unused*/) optional_noexcept
-    {
-        reset();
-        return *this;
-    }
-
-    // 2 (C++98and later) - copy-assign from optional
-#if optional_CPP11_OR_GREATER
-    // NOLINTNEXTLINE( cppcoreguidelines-c-copy-assignment-signature, misc-unconventional-assign-operator )
-    optional_REQUIRES_R(
-        optional &,
-        true
-//      std::is_copy_constructible<T>::value
-//      && std::is_copy_assignable<T>::value
-    )
-    operator=( optional const & other )
-        noexcept(
-            std11::is_nothrow_move_assignable<T>::value
-            && std11::is_nothrow_move_constructible<T>::value
-        )
-#else
-    optional & operator=( optional const & other )
-#endif
-    {
-        if      ( (has_value() == true ) && (other.has_value() == false) ) { reset(); }
-        else if ( (has_value() == false) && (other.has_value() == true ) ) { initialize( *other ); }
-        else if ( (has_value() == true ) && (other.has_value() == true ) ) { contained.value() = *other; }
-        return *this;
-    }
-
-#if optional_CPP11_OR_GREATER
-
-    // 3 (C++11) - move-assign from optional
-    // NOLINTNEXTLINE( cppcoreguidelines-c-copy-assignment-signature, misc-unconventional-assign-operator )
-    optional_REQUIRES_R(
-        optional &,
-        true
-//      std11::is_move_constructible<T>::value
-//      && std::is_move_assignable<T>::value
-    )
-    operator=( optional && other ) noexcept
-    {
-        if      ( (has_value() == true ) && (other.has_value() == false) ) { reset(); }
-        else if ( (has_value() == false) && (other.has_value() == true ) ) { initialize( std::move( *other ) ); }
-        else if ( (has_value() == true ) && (other.has_value() == true ) ) { contained.value() = std::move( *other ); }
-        return *this;
-    }
-
-    // 4 (C++11) - move-assign from value
-    template< typename U = T >
-        // NOLINTNEXTLINE( cppcoreguidelines-c-copy-assignment-signature, misc-unconventional-assign-operator )
-        optional_REQUIRES_R(
-            optional &,
-            std::is_constructible<T , U>::value
-            && std11::is_assignable<T&, U>::value
-            && !std::is_same<typename std20::remove_cvref<U>::type, nonstd_lite_in_place_t(U)>::value
-            && !std::is_same<typename std20::remove_cvref<U>::type, optional<T>>::value
-            && !(std::is_scalar<T>::value && std::is_same<T, typename std::decay<U>::type>::value)
-        )
-    operator=( U && value )
-    {
-        if ( has_value() )
-        {
-            contained.value() = std::forward<U>( value );
-        }
-        else
-        {
-            initialize( T( std::forward<U>( value ) ) );
-        }
-        return *this;
-    }
-
-#else // optional_CPP11_OR_GREATER
-
-    // 4 (C++98) - copy-assign from value
-    template< typename U /*= T*/ >
-    optional & operator=( U const & value )
-    {
-        if ( has_value() ) contained.value() = value;
-        else               initialize( T( value ) );
-        return *this;
-    }
-
-#endif // optional_CPP11_OR_GREATER
-
-    // 5 (C++98 and later) - converting copy-assign from optional
-    template< typename U >
-#if optional_CPP11_OR_GREATER
-        // NOLINTNEXTLINE( cppcoreguidelines-c-copy-assignment-signature, misc-unconventional-assign-operator )
-        optional_REQUIRES_R(
-            optional&,
-            std::is_constructible<  T , U const &>::value
-            &&  std11::is_assignable< T&, U const &>::value
-            && !std::is_constructible<T, optional<U> &          >::value
-            && !std::is_constructible<T, optional<U> &&         >::value
-            && !std::is_constructible<T, optional<U> const &    >::value
-            && !std::is_constructible<T, optional<U> const &&   >::value
-            && !std::is_convertible<     optional<U> &       , T>::value
-            && !std::is_convertible<     optional<U> &&      , T>::value
-            && !std::is_convertible<     optional<U> const & , T>::value
-            && !std::is_convertible<     optional<U> const &&, T>::value
-            && !std11::is_assignable<  T&, optional<U> &          >::value
-            && !std11::is_assignable<  T&, optional<U> &&         >::value
-            && !std11::is_assignable<  T&, optional<U> const &    >::value
-            && !std11::is_assignable<  T&, optional<U> const &&   >::value
-        )
-#else
-    optional&
-#endif // optional_CPP11_OR_GREATER
-    operator=( optional<U> const & other )
-    {
-        return *this = optional( other );
-    }
-
-#if optional_CPP11_OR_GREATER
-
-    // 6 (C++11) -  converting move-assign from optional
-    template< typename U >
-        // NOLINTNEXTLINE( cppcoreguidelines-c-copy-assignment-signature, misc-unconventional-assign-operator )
-        optional_REQUIRES_R(
-            optional&,
-            std::is_constructible<  T , U>::value
-            &&  std11::is_assignable< T&, U>::value
-            && !std::is_constructible<T, optional<U> &          >::value
-            && !std::is_constructible<T, optional<U> &&         >::value
-            && !std::is_constructible<T, optional<U> const &    >::value
-            && !std::is_constructible<T, optional<U> const &&   >::value
-            && !std::is_convertible<     optional<U> &       , T>::value
-            && !std::is_convertible<     optional<U> &&      , T>::value
-            && !std::is_convertible<     optional<U> const & , T>::value
-            && !std::is_convertible<     optional<U> const &&, T>::value
-            && !std11::is_assignable<  T&, optional<U> &          >::value
-            && !std11::is_assignable<  T&, optional<U> &&         >::value
-            && !std11::is_assignable<  T&, optional<U> const &    >::value
-            && !std11::is_assignable<  T&, optional<U> const &&   >::value
-        )
-    operator=( optional<U> && other )
-    {
-        return *this = optional( std::move( other ) );
-    }
-
-    // 7 (C++11) - emplace
-    template< typename... Args
-        optional_REQUIRES_T(
-            std::is_constructible<T, Args&&...>::value
-        )
-    >
-    T& emplace( Args&&... args )
-    {
-        *this = nullopt;
-        contained.emplace( std::forward<Args>(args)...  );
-        has_value_ = true;
-        return contained.value();
-    }
-
-    // 8 (C++11) - emplace, initializer-list
-    template< typename U, typename... Args
-        optional_REQUIRES_T(
-            std::is_constructible<T, std::initializer_list<U>&, Args&&...>::value
-        )
-    >
-    T& emplace( std::initializer_list<U> il, Args&&... args )
-    {
-        *this = nullopt;
-        contained.emplace( il, std::forward<Args>(args)...  );
-        has_value_ = true;
-        return contained.value();
-    }
-
-#endif // optional_CPP11_OR_GREATER
-
-    // x.x.3.4, swap
-
-    void swap( optional & other )
-#if optional_CPP11_OR_GREATER
-        noexcept(
-            std11::is_nothrow_move_constructible<T>::value
-            && std17::is_nothrow_swappable<T>::value
-        )
-#endif
-    {
-        using std::swap;
-        if      ( (has_value() == true ) && (other.has_value() == true ) ) { swap( **this, *other ); }
-        else if ( (has_value() == false) && (other.has_value() == true ) ) { initialize( std11::move(*other) ); other.reset(); }
-        else if ( (has_value() == true ) && (other.has_value() == false) ) { other.initialize( std11::move(**this) ); reset(); }
-    }
-
-    // x.x.3.5, observers
-
-    optional_constexpr value_type const * operator ->() const
-    {
-        return assert( has_value() ),
-            contained.value_ptr();
-    }
-
-    optional_constexpr14 value_type * operator ->()
-    {
-        return assert( has_value() ),
-            contained.value_ptr();
-    }
-
-    optional_constexpr value_type const & operator *() const optional_ref_qual
-    {
-        return assert( has_value() ),
-            contained.value();
-    }
-
-    optional_constexpr14 value_type & operator *() optional_ref_qual
-    {
-        return assert( has_value() ),
-            contained.value();
-    }
-
-#if optional_HAVE( REF_QUALIFIER )
-
-    optional_constexpr value_type const && operator *() const optional_refref_qual
-    {
-        return std::move( **this );
-    }
-
-    optional_constexpr14 value_type && operator *() optional_refref_qual
-    {
-        return std::move( **this );
-    }
-
-#endif
-
-#if optional_CPP11_OR_GREATER
-    optional_constexpr explicit operator bool() const optional_noexcept
-    {
-        return has_value();
-    }
-#else
-    optional_constexpr operator safe_bool() const optional_noexcept
-    {
-        return has_value() ? &optional::this_type_does_not_support_comparisons : 0;
-    }
-#endif
-
-    // NOLINTNEXTLINE( modernize-use-nodiscard )
-    /*optional_nodiscard*/ optional_constexpr bool has_value() const optional_noexcept
-    {
-        return has_value_;
-    }
-
-    // NOLINTNEXTLINE( modernize-use-nodiscard )
-    /*optional_nodiscard*/ optional_constexpr14 value_type const & value() const optional_ref_qual
-    {
-#if optional_CONFIG_NO_EXCEPTIONS
-        assert( has_value() );
-#else
-        if ( ! has_value() )
-        {
-            throw bad_optional_access();
-        }
-#endif
-        return contained.value();
-    }
-
-    optional_constexpr14 value_type & value() optional_ref_qual
-    {
-#if optional_CONFIG_NO_EXCEPTIONS
-        assert( has_value() );
-#else
-        if ( ! has_value() )
-        {
-            throw bad_optional_access();
-        }
-#endif
-        return contained.value();
-    }
-
-#if optional_HAVE( REF_QUALIFIER )  &&  ( !optional_COMPILER_GNUC_VERSION || optional_COMPILER_GNUC_VERSION >= 490 )
-
-    // NOLINTNEXTLINE( modernize-use-nodiscard )
-    /*optional_nodiscard*/ optional_constexpr value_type const && value() const optional_refref_qual
-    {
-        return std::move( value() );
-    }
-
-    optional_constexpr14 value_type && value() optional_refref_qual
-    {
-        return std::move( value() );
-    }
-
-#endif
-
-#if optional_HAVE( REF_QUALIFIER )
-
-    template< typename U >
-    optional_constexpr value_type value_or( U && v ) const optional_ref_qual
-    {
-        return has_value() ? contained.value() : static_cast<T>(std::forward<U>( v ) );
-    }
-
-    template< typename U >
-    optional_constexpr14 value_type value_or( U && v ) optional_refref_qual
-    {
-#if optional_COMPILER_CLANG_VERSION
-        return has_value() ? /*std::move*/( contained.value() ) : static_cast<T>(std::forward<U>( v ) );
-#else
-        return has_value() ? std::move( contained.value() ) : static_cast<T>(std::forward<U>( v ) );
-#endif
-    }
-
-#else
-
-    template< typename U >
-    optional_constexpr value_type value_or( U const & v ) const
-    {
-        return has_value() ? contained.value() : static_cast<value_type>( v );
-    }
-
-#endif // optional_HAVE( REF_QUALIFIER )
-
-#if !optional_CONFIG_NO_EXTENSIONS
-#if  optional_HAVE( REF_QUALIFIER )
-
-    template< typename F >
-    optional_constexpr value_type value_or_eval( F f ) const &
-    {
-        return has_value() ? contained.value() : f();
-    }
-
-    template< typename F >
-    optional_constexpr14 value_type value_or_eval( F f ) &&
-    {
-        if ( has_value() )
-        {
-            return std::move( contained.value() );
-        }
-        else
-        {
-            return f();
-        }
-    }
-
-#else
-
-    template< typename F >
-    optional_constexpr value_type value_or_eval( F f ) const
-    {
-        return has_value() ? contained.value() : f();
-    }
-
-#endif //  optional_HAVE( REF_QUALIFIER )
-#endif // !optional_CONFIG_NO_EXTENSIONS
-
-    // x.x.3.6, modifiers
-
-    void reset() optional_noexcept
-    {
-        if ( has_value() )
-        {
-            contained.destruct_value();
-        }
-
-        has_value_ = false;
-    }
-
-private:
-    void this_type_does_not_support_comparisons() const {}
-
-    template< typename V >
-    void initialize( V const & value )
-    {
-        assert( ! has_value()  );
-        contained.construct_value( value );
-        has_value_ = true;
-    }
-
-#if optional_CPP11_OR_GREATER
-    template< typename V >
-    void initialize( V && value )
-    {
-        assert( ! has_value()  );
-        contained.construct_value( std::move( value ) );
-        has_value_ = true;
-    }
-
-#endif
-
-private:
-    bool has_value_;
-    detail::storage_t< value_type > contained;
-
-};
-
-// Relational operators
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator==( optional<T> const & x, optional<U> const & y )
-{
-    return bool(x) != bool(y) ? false : !bool( x ) ? true : *x == *y;
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator!=( optional<T> const & x, optional<U> const & y )
-{
-    return !(x == y);
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator<( optional<T> const & x, optional<U> const & y )
-{
-    return (!y) ? false : (!x) ? true : *x < *y;
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator>( optional<T> const & x, optional<U> const & y )
-{
-    return (y < x);
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator<=( optional<T> const & x, optional<U> const & y )
-{
-    return !(y < x);
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator>=( optional<T> const & x, optional<U> const & y )
-{
-    return !(x < y);
-}
-
-// Comparison with nullopt
-
-template< typename T >
-optional_nodiscard optional_constexpr bool operator==( optional<T> const & x, nullopt_t /*unused*/ ) optional_noexcept
-{
-    return (!x);
-}
-
-template< typename T >
-optional_nodiscard optional_constexpr bool operator==( nullopt_t /*unused*/, optional<T> const & x ) optional_noexcept
-{
-    return (!x);
-}
-
-template< typename T >
-optional_nodiscard optional_constexpr bool operator!=( optional<T> const & x, nullopt_t /*unused*/ ) optional_noexcept
-{
-    return bool(x);
-}
-
-template< typename T >
-optional_nodiscard optional_constexpr bool operator!=( nullopt_t /*unused*/, optional<T> const & x ) optional_noexcept
-{
-    return bool(x);
-}
-
-template< typename T >
-optional_nodiscard optional_constexpr bool operator<( optional<T> const & /*unused*/, nullopt_t /*unused*/ ) optional_noexcept
-{
-    return false;
-}
-
-template< typename T >
-optional_nodiscard optional_constexpr bool operator<( nullopt_t /*unused*/, optional<T> const & x ) optional_noexcept
-{
-    return bool(x);
-}
-
-template< typename T >
-optional_nodiscard optional_constexpr bool operator<=( optional<T> const & x, nullopt_t /*unused*/ ) optional_noexcept
-{
-    return (!x);
-}
-
-template< typename T >
-optional_nodiscard optional_constexpr bool operator<=( nullopt_t /*unused*/, optional<T> const & /*unused*/ ) optional_noexcept
-{
-    return true;
-}
-
-template< typename T >
-optional_nodiscard optional_constexpr bool operator>( optional<T> const & x, nullopt_t /*unused*/ ) optional_noexcept
-{
-    return bool(x);
-}
-
-template< typename T >
-optional_nodiscard optional_constexpr bool operator>( nullopt_t /*unused*/, optional<T> const & /*unused*/ ) optional_noexcept
-{
-    return false;
-}
-
-template< typename T >
-optional_nodiscard optional_constexpr bool operator>=( optional<T> const & /*unused*/, nullopt_t /*unused*/ ) optional_noexcept
-{
-    return true;
-}
-
-template< typename T >
-optional_nodiscard optional_constexpr bool operator>=( nullopt_t /*unused*/, optional<T> const & x ) optional_noexcept
-{
-    return (!x);
-}
-
-// Comparison with T
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator==( optional<T> const & x, U const & v )
-{
-    return bool(x) ? *x == v : false;
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator==( U const & v, optional<T> const & x )
-{
-    return bool(x) ? v == *x : false;
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator!=( optional<T> const & x, U const & v )
-{
-    return bool(x) ? *x != v : true;
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator!=( U const & v, optional<T> const & x )
-{
-    return bool(x) ? v != *x : true;
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator<( optional<T> const & x, U const & v )
-{
-    return bool(x) ? *x < v : true;
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator<( U const & v, optional<T> const & x )
-{
-    return bool(x) ? v < *x : false;
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator<=( optional<T> const & x, U const & v )
-{
-    return bool(x) ? *x <= v : true;
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator<=( U const & v, optional<T> const & x )
-{
-    return bool(x) ? v <= *x : false;
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator>( optional<T> const & x, U const & v )
-{
-    return bool(x) ? *x > v : false;
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator>( U const & v, optional<T> const & x )
-{
-    return bool(x) ? v > *x : true;
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator>=( optional<T> const & x, U const & v )
-{
-    return bool(x) ? *x >= v : false;
-}
-
-template< typename T, typename U >
-optional_nodiscard optional_constexpr bool operator>=( U const & v, optional<T> const & x )
-{
-    return bool(x) ? v >= *x : true;
-}
-
-// Specialized algorithms
-
-template< typename T
-#if optional_CPP11_OR_GREATER
-    optional_REQUIRES_T(
-        std11::is_move_constructible<T>::value
-        && std17::is_swappable<T>::value )
-#endif
->
-void swap( optional<T> & x, optional<T> & y )
-#if optional_CPP11_OR_GREATER
-    noexcept( noexcept( x.swap(y) ) )
-#endif
-{
-    x.swap( y );
-}
-
-#if optional_CPP11_OR_GREATER
-
-template< typename T >
-optional_constexpr optional< typename std::decay<T>::type > make_optional( T && value )
-{
-    return optional< typename std::decay<T>::type >( std::forward<T>( value ) );
-}
-
-template< typename T, typename...Args >
-optional_constexpr optional<T> make_optional( Args&&... args )
-{
-    return optional<T>( nonstd_lite_in_place(T), std::forward<Args>(args)...);
-}
-
-template< typename T, typename U, typename... Args >
-optional_constexpr optional<T> make_optional( std::initializer_list<U> il, Args&&... args )
-{
-    return optional<T>( nonstd_lite_in_place(T), il, std::forward<Args>(args)...);
-}
-
-#else
-
-template< typename T >
-optional<T> make_optional( T const & value )
-{
-    return optional<T>( value );
-}
-
-#endif // optional_CPP11_OR_GREATER
-
-} // namespace optional_lite
-
-using optional_lite::optional;
-using optional_lite::nullopt_t;
-using optional_lite::nullopt;
-
-#if ! optional_CONFIG_NO_EXCEPTIONS
-using optional_lite::bad_optional_access;
-#endif
-
-using optional_lite::make_optional;
-
-} // namespace nonstd
-
-#if optional_CPP11_OR_GREATER
-
-// specialize the std::hash algorithm:
-
-namespace std {
-
-template< class T >
-struct hash< nonstd::optional<T> >
-{
-public:
-    std::size_t operator()( nonstd::optional<T> const & v ) const optional_noexcept
-    {
-        return bool( v ) ? std::hash<T>{}( *v ) : 0;
-    }
-};
-
-} //namespace std
-
-#endif // optional_CPP11_OR_GREATER
-
-#if defined(__clang__)
-# pragma clang diagnostic pop
-#elif defined(__GNUC__)
-# pragma GCC   diagnostic pop
-#elif defined(_MSC_VER )
-# pragma warning( pop )
-#endif
-
-#endif // optional_USES_STD_OPTIONAL
-
-#endif // NONSTD_OPTIONAL_LITE_HPP
diff --git a/ndn-cxx/encoding/nfd-constants.hpp b/ndn-cxx/encoding/nfd-constants.hpp
index 686f4c8..6b3389f 100644
--- a/ndn-cxx/encoding/nfd-constants.hpp
+++ b/ndn-cxx/encoding/nfd-constants.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -22,7 +22,9 @@
 #ifndef NDN_CXX_ENCODING_NFD_CONSTANTS_HPP
 #define NDN_CXX_ENCODING_NFD_CONSTANTS_HPP
 
-#include "ndn-cxx/detail/common.hpp"
+#include <cstdint>
+#include <iosfwd>
+#include <limits>
 
 namespace ndn {
 namespace nfd {
diff --git a/ndn-cxx/encoding/tlv.hpp b/ndn-cxx/encoding/tlv.hpp
index 35a46e4..4513d13 100644
--- a/ndn-cxx/encoding/tlv.hpp
+++ b/ndn-cxx/encoding/tlv.hpp
@@ -26,6 +26,7 @@
 
 #include <cstring>
 #include <iterator>
+#include <limits>
 #include <ostream>
 #include <vector>
 
@@ -168,10 +169,10 @@
  * @brief Read VAR-NUMBER in NDN-TLV encoding.
  * @tparam Iterator an iterator or pointer that dereferences to uint8_t or compatible type
  *
- * @param [inout] begin  Begin of the buffer, will be incremented to point to the first byte after
+ * @param[in,out] begin  Begin of the buffer, will be incremented to point to the first byte after
  *                       the read VAR-NUMBER
- * @param [in]    end    End of the buffer
- * @param [out]   number Read VAR-NUMBER
+ * @param[in]     end    End of the buffer
+ * @param[out]    number Read VAR-NUMBER
  *
  * @return true if number was successfully read from input, false otherwise
  */
@@ -183,10 +184,10 @@
  * @brief Read TLV-TYPE.
  * @tparam Iterator an iterator or pointer that dereferences to uint8_t or compatible type
  *
- * @param [inout] begin Begin of the buffer, will be incremented to point to the first byte after
+ * @param[in,out] begin Begin of the buffer, will be incremented to point to the first byte after
  *                      the read TLV-TYPE
- * @param [in]    end   End of the buffer
- * @param [out]   type  Read TLV-TYPE
+ * @param[in]     end   End of the buffer
+ * @param[out]    type  Read TLV-TYPE
  *
  * @return true if TLV-TYPE was successfully read from input, false otherwise
  * @note This function is largely equivalent to readVarNumber(), except that it returns false if
@@ -200,9 +201,9 @@
  * @brief Read VAR-NUMBER in NDN-TLV encoding.
  * @tparam Iterator an iterator or pointer that dereferences to uint8_t or compatible type
  *
- * @param [inout] begin Begin of the buffer, will be incremented to point to the first byte after
+ * @param[in,out] begin Begin of the buffer, will be incremented to point to the first byte after
  *                      the read VAR-NUMBER
- * @param [in]    end   End of the buffer
+ * @param[in]     end   End of the buffer
  *
  * @throw tlv::Error VAR-NUMBER cannot be read
  */
@@ -214,9 +215,9 @@
  * @brief Read TLV-TYPE.
  * @tparam Iterator an iterator or pointer that dereferences to uint8_t or compatible type
  *
- * @param [inout] begin Begin of the buffer, will be incremented to point to the first byte after
+ * @param[in,out] begin Begin of the buffer, will be incremented to point to the first byte after
  *                      the read TLV-TYPE
- * @param [in]    end   End of the buffer
+ * @param[in]     end   End of the buffer
  *
  * @throw tlv::Error TLV-TYPE cannot be read
  * @note This function is largely equivalent to readVarNumber(), except that it throws if
@@ -243,10 +244,10 @@
  * @brief Read a NonNegativeInteger in NDN-TLV encoding.
  * @tparam Iterator an iterator or pointer that dereferences to uint8_t or compatible type
  *
- * @param [in]    size  size of the NonNegativeInteger
- * @param [inout] begin Begin of the buffer, will be incremented to point to the first byte after
+ * @param[in]     size  size of the NonNegativeInteger
+ * @param[in,out] begin Begin of the buffer, will be incremented to point to the first byte after
  *                      the read NonNegativeInteger
- * @param [in]    end   End of the buffer
+ * @param[in]     end   End of the buffer
  *
  * @throw tlv::Error number cannot be read
  * @note How many bytes to read is directly controlled by \p size, which can be either 1, 2, 4, or 8.
diff --git a/ndn-cxx/face.cpp b/ndn-cxx/face.cpp
index 4a19701..b73039e 100644
--- a/ndn-cxx/face.cpp
+++ b/ndn-cxx/face.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -23,7 +23,6 @@
 #include "ndn-cxx/encoding/tlv.hpp"
 #include "ndn-cxx/impl/face-impl.hpp"
 #include "ndn-cxx/net/face-uri.hpp"
-#include "ndn-cxx/security/signing-helpers.hpp"
 #include "ndn-cxx/util/config-file.hpp"
 #include "ndn-cxx/util/scope.hpp"
 #include "ndn-cxx/util/time.hpp"
@@ -252,7 +251,7 @@
   nfd::CommandOptions options;
   options.setSigningInfo(signingInfo);
 
-  auto id = m_impl->registerPrefix(prefix, onSuccess, onFailure, flags, options, nullopt, nullptr);
+  auto id = m_impl->registerPrefix(prefix, onSuccess, onFailure, flags, options, std::nullopt, nullptr);
   return RegisteredPrefixHandle(m_impl, id);
 }
 
diff --git a/ndn-cxx/impl/common-pch.hpp b/ndn-cxx/impl/common-pch.hpp
index eea4287..539d977 100644
--- a/ndn-cxx/impl/common-pch.hpp
+++ b/ndn-cxx/impl/common-pch.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -30,7 +30,9 @@
 // STL headers to precompile
 #include <atomic>
 #include <iterator>
+#include <limits>
 #include <list>
+#include <optional>
 #include <ostream>
 #include <unordered_map>
 #include <unordered_set>
diff --git a/ndn-cxx/impl/face-impl.hpp b/ndn-cxx/impl/face-impl.hpp
index 86ccb9e..750e804 100644
--- a/ndn-cxx/impl/face-impl.hpp
+++ b/ndn-cxx/impl/face-impl.hpp
@@ -154,17 +154,17 @@
   /**
    * @return A Nack to be sent to the forwarder, or nullopt if no Nack should be sent.
    */
-  optional<lp::Nack>
+  std::optional<lp::Nack>
   nackPendingInterests(const lp::Nack& nack)
   {
-    optional<lp::Nack> outNack;
+    std::optional<lp::Nack> outNack;
     m_pendingInterestTable.removeIf([&] (PendingInterest& entry) {
       if (!nack.getInterest().matchesInterest(*entry.getInterest())) {
         return false;
       }
       NDN_LOG_DEBUG("   nacking " << *entry.getInterest() << " from " << entry.getOrigin());
 
-      optional<lp::Nack> outNack1 = entry.recordNack(nack);
+      auto outNack1 = entry.recordNack(nack);
       if (!outNack1) {
         return false;
       }
@@ -234,7 +234,7 @@
   putNack(const lp::Nack& nack)
   {
     NDN_LOG_DEBUG("<N " << nack.getInterest() << '~' << nack.getHeader().getReason());
-    optional<lp::Nack> outNack = nackPendingInterests(nack);
+    auto outNack = nackPendingInterests(nack);
     if (!outNack) {
       return;
     }
@@ -255,8 +255,10 @@
   registerPrefix(const Name& prefix,
                  const RegisterPrefixSuccessCallback& onSuccess,
                  const RegisterPrefixFailureCallback& onFailure,
-                 uint64_t flags, const nfd::CommandOptions& options,
-                 const optional<InterestFilter>& filter, const InterestCallback& onInterest)
+                 uint64_t flags,
+                 const nfd::CommandOptions& options,
+                 const std::optional<InterestFilter>& filter,
+                 const InterestCallback& onInterest)
   {
     NDN_LOG_INFO("registering prefix: " << prefix);
     auto id = m_registeredPrefixTable.allocateId();
diff --git a/ndn-cxx/impl/pending-interest.hpp b/ndn-cxx/impl/pending-interest.hpp
index 1f88fdb..6e36ba6 100644
--- a/ndn-cxx/impl/pending-interest.hpp
+++ b/ndn-cxx/impl/pending-interest.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -114,7 +114,7 @@
    * @return Least severe Nack if all destinations where the Interest was forwarded have Nacked;
    *         otherwise, @c nullopt.
    */
-  optional<lp::Nack>
+  std::optional<lp::Nack>
   recordNack(const lp::Nack& nack)
   {
     --m_nNotNacked;
@@ -124,7 +124,7 @@
       m_leastSevereNack = nack;
     }
 
-    return m_nNotNacked > 0 ? nullopt : m_leastSevereNack;
+    return m_nNotNacked > 0 ? std::nullopt : m_leastSevereNack;
   }
 
   /**
@@ -180,7 +180,7 @@
   TimeoutCallback m_timeoutCallback;
   scheduler::ScopedEventId m_timeoutEvent;
   int m_nNotNacked = 0; ///< number of Interest destinations that have not Nacked
-  optional<lp::Nack> m_leastSevereNack;
+  std::optional<lp::Nack> m_leastSevereNack;
 };
 
 } // namespace ndn
diff --git a/ndn-cxx/ims/in-memory-storage.hpp b/ndn-cxx/ims/in-memory-storage.hpp
index 0855e61..67fd76d 100644
--- a/ndn-cxx/ims/in-memory-storage.hpp
+++ b/ndn-cxx/ims/in-memory-storage.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -25,6 +25,7 @@
 #include "ndn-cxx/ims/in-memory-storage-entry.hpp"
 
 #include <iterator>
+#include <limits>
 #include <stack>
 
 #include <boost/multi_index_container.hpp>
diff --git a/ndn-cxx/interest.cpp b/ndn-cxx/interest.cpp
index 345d60b..cd802cd 100644
--- a/ndn-cxx/interest.cpp
+++ b/ndn-cxx/interest.cpp
@@ -411,7 +411,7 @@
 }
 
 Interest&
-Interest::setNonce(optional<Interest::Nonce> nonce)
+Interest::setNonce(std::optional<Interest::Nonce> nonce)
 {
   if (nonce != m_nonce) {
     m_nonce = nonce;
@@ -448,7 +448,7 @@
 }
 
 Interest&
-Interest::setHopLimit(optional<uint8_t> hopLimit)
+Interest::setHopLimit(std::optional<uint8_t> hopLimit)
 {
   if (hopLimit != m_hopLimit) {
     m_hopLimit = hopLimit;
@@ -527,14 +527,14 @@
          m_name[-1].type() == tlv::ParametersSha256DigestComponent;
 }
 
-optional<SignatureInfo>
+std::optional<SignatureInfo>
 Interest::getSignatureInfo() const
 {
   auto blockIt = findFirstParameter(tlv::InterestSignatureInfo);
   if (blockIt != m_parameters.end()) {
-    return make_optional<SignatureInfo>(*blockIt, SignatureInfo::Type::Interest);
+    return std::make_optional<SignatureInfo>(*blockIt, SignatureInfo::Type::Interest);
   }
-  return nullopt;
+  return std::nullopt;
 }
 
 Interest&
diff --git a/ndn-cxx/interest.hpp b/ndn-cxx/interest.hpp
index 9777c14..d8ef0ea 100644
--- a/ndn-cxx/interest.hpp
+++ b/ndn-cxx/interest.hpp
@@ -256,7 +256,7 @@
    * Use `setNonce(nullopt)` to remove any nonce from the Interest.
    */
   Interest&
-  setNonce(optional<Nonce> nonce);
+  setNonce(std::optional<Nonce> nonce);
 
   /**
    * @brief Change nonce value.
@@ -286,7 +286,7 @@
   /**
    * @brief Get the %Interest's hop limit.
    */
-  optional<uint8_t>
+  std::optional<uint8_t>
   getHopLimit() const noexcept
   {
     return m_hopLimit;
@@ -298,7 +298,7 @@
    * Use `setHopLimit(nullopt)` to remove any hop limit from the Interest.
    */
   Interest&
-  setHopLimit(optional<uint8_t> hopLimit);
+  setHopLimit(std::optional<uint8_t> hopLimit);
 
   /**
    * @brief Return whether this Interest has any `ApplicationParameters` element.
@@ -388,7 +388,7 @@
    * @brief Get the `InterestSignatureInfo` element.
    * @retval nullopt The element is not present.
    */
-  optional<SignatureInfo>
+  std::optional<SignatureInfo>
   getSignatureInfo() const;
 
   /**
@@ -494,9 +494,9 @@
 
   Name m_name;
   std::vector<Name> m_forwardingHint;
-  mutable optional<Nonce> m_nonce;
+  mutable std::optional<Nonce> m_nonce;
   time::milliseconds m_interestLifetime = DEFAULT_INTEREST_LIFETIME;
-  optional<uint8_t> m_hopLimit;
+  std::optional<uint8_t> m_hopLimit;
   bool m_canBePrefix = false;
   bool m_mustBeFresh = false;
 
diff --git a/ndn-cxx/lp/prefix-announcement-header.cpp b/ndn-cxx/lp/prefix-announcement-header.cpp
index 8761be1..3c5de4d 100644
--- a/ndn-cxx/lp/prefix-announcement-header.cpp
+++ b/ndn-cxx/lp/prefix-announcement-header.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -35,7 +35,7 @@
 PrefixAnnouncementHeader::PrefixAnnouncementHeader(PrefixAnnouncement prefixAnn)
   : m_prefixAnn(std::move(prefixAnn))
 {
-  if (m_prefixAnn->getData() == nullopt) {
+  if (!m_prefixAnn->getData()) {
     NDN_THROW(Error("PrefixAnnouncement does not contain Data"));
   }
 }
@@ -44,7 +44,7 @@
 size_t
 PrefixAnnouncementHeader::wireEncode(EncodingImpl<TAG>& encoder) const
 {
-  if (m_prefixAnn == nullopt) {
+  if (!m_prefixAnn) {
     NDN_THROW(Error("PrefixAnnouncementHeader does not contain a PrefixAnnouncement"));
   }
 
diff --git a/ndn-cxx/lp/prefix-announcement-header.hpp b/ndn-cxx/lp/prefix-announcement-header.hpp
index a316ee4..59e4cc9 100644
--- a/ndn-cxx/lp/prefix-announcement-header.hpp
+++ b/ndn-cxx/lp/prefix-announcement-header.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -61,14 +61,14 @@
   void
   wireDecode(const Block& wire);
 
-  const optional<PrefixAnnouncement>&
+  const std::optional<PrefixAnnouncement>&
   getPrefixAnn() const
   {
     return m_prefixAnn;
   }
 
 private:
-  optional<PrefixAnnouncement> m_prefixAnn;
+  std::optional<PrefixAnnouncement> m_prefixAnn;
 };
 
 NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(PrefixAnnouncementHeader);
diff --git a/ndn-cxx/meta-info.cpp b/ndn-cxx/meta-info.cpp
index 2d64691..f95b69d 100644
--- a/ndn-cxx/meta-info.cpp
+++ b/ndn-cxx/meta-info.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -63,7 +63,7 @@
 }
 
 MetaInfo&
-MetaInfo::setFinalBlock(optional<name::Component> finalBlockId)
+MetaInfo::setFinalBlock(std::optional<name::Component> finalBlockId)
 {
   m_wire.reset();
   m_finalBlockId = std::move(finalBlockId);
@@ -215,7 +215,7 @@
     ++val;
   }
   else {
-    m_finalBlockId = nullopt;
+    m_finalBlockId = std::nullopt;
   }
 
   // AppMetaInfo (if any)
diff --git a/ndn-cxx/meta-info.hpp b/ndn-cxx/meta-info.hpp
index ff8a1fe..f2dd699 100644
--- a/ndn-cxx/meta-info.hpp
+++ b/ndn-cxx/meta-info.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -25,10 +25,10 @@
 #include "ndn-cxx/name-component.hpp"
 #include "ndn-cxx/encoding/block.hpp"
 #include "ndn-cxx/encoding/encoding-buffer.hpp"
-#include "ndn-cxx/util/optional.hpp"
 #include "ndn-cxx/util/time.hpp"
 
 #include <list>
+#include <optional>
 
 namespace ndn {
 
@@ -118,18 +118,20 @@
   MetaInfo&
   setFreshnessPeriod(time::milliseconds freshnessPeriod);
 
-  /** @brief Return the value of `FinalBlockId`.
+  /**
+   * @brief Return the value of `FinalBlockId`.
    */
-  const optional<name::Component>&
+  const std::optional<name::Component>&
   getFinalBlock() const
   {
     return m_finalBlockId;
   }
 
-  /** @brief Set `FinalBlockId`.
+  /**
+   * @brief Set `FinalBlockId`.
    */
   MetaInfo&
-  setFinalBlock(optional<name::Component> finalBlockId);
+  setFinalBlock(std::optional<name::Component> finalBlockId);
 
 public: // app-defined MetaInfo items
   /**
@@ -195,7 +197,7 @@
 private:
   uint32_t m_type;
   time::milliseconds m_freshnessPeriod;
-  optional<name::Component> m_finalBlockId;
+  std::optional<name::Component> m_finalBlockId;
   std::list<Block> m_appMetaInfo;
 
   mutable Block m_wire;
diff --git a/ndn-cxx/metadata-object.cpp b/ndn-cxx/metadata-object.cpp
index b764aba..46c67d3 100644
--- a/ndn-cxx/metadata-object.cpp
+++ b/ndn-cxx/metadata-object.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -53,7 +53,7 @@
 MetadataObject::makeData(Name discoveryInterestName,
                          KeyChain& keyChain,
                          const ndn::security::SigningInfo& si,
-                         optional<uint64_t> version,
+                         std::optional<uint64_t> version,
                          time::milliseconds freshnessPeriod) const
 {
   if (discoveryInterestName.empty() || discoveryInterestName[-1] != getKeywordComponent()) {
diff --git a/ndn-cxx/metadata-object.hpp b/ndn-cxx/metadata-object.hpp
index 6ad674a..0d9617b 100644
--- a/ndn-cxx/metadata-object.hpp
+++ b/ndn-cxx/metadata-object.hpp
@@ -83,7 +83,7 @@
   makeData(Name discoveryInterestName,
            KeyChain& keyChain,
            const ndn::security::SigningInfo& si = security::SigningInfo(),
-           optional<uint64_t> version = nullopt,
+           std::optional<uint64_t> version = std::nullopt,
            time::milliseconds freshnessPeriod = 10_ms) const;
 
   /**
diff --git a/ndn-cxx/mgmt/nfd/face-query-filter.cpp b/ndn-cxx/mgmt/nfd/face-query-filter.cpp
index a0f8e19..39264fa 100644
--- a/ndn-cxx/mgmt/nfd/face-query-filter.cpp
+++ b/ndn-cxx/mgmt/nfd/face-query-filter.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -119,7 +119,7 @@
     ++val;
   }
   else {
-    m_faceId = nullopt;
+    m_faceId = std::nullopt;
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::UriScheme) {
@@ -151,7 +151,7 @@
     ++val;
   }
   else {
-    m_faceScope = nullopt;
+    m_faceScope = std::nullopt;
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::FacePersistency) {
@@ -159,7 +159,7 @@
     ++val;
   }
   else {
-    m_facePersistency = nullopt;
+    m_facePersistency = std::nullopt;
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::LinkType) {
@@ -167,7 +167,7 @@
     ++val;
   }
   else {
-    m_linkType = nullopt;
+    m_linkType = std::nullopt;
   }
 }
 
@@ -195,7 +195,7 @@
 FaceQueryFilter::unsetFaceId()
 {
   m_wire.reset();
-  m_faceId = nullopt;
+  m_faceId = std::nullopt;
   return *this;
 }
 
@@ -253,7 +253,7 @@
 FaceQueryFilter::unsetFaceScope()
 {
   m_wire.reset();
-  m_faceScope = nullopt;
+  m_faceScope = std::nullopt;
   return *this;
 }
 
@@ -269,7 +269,7 @@
 FaceQueryFilter::unsetFacePersistency()
 {
   m_wire.reset();
-  m_facePersistency = nullopt;
+  m_facePersistency = std::nullopt;
   return *this;
 }
 
@@ -285,7 +285,7 @@
 FaceQueryFilter::unsetLinkType()
 {
   m_wire.reset();
-  m_linkType = nullopt;
+  m_linkType = std::nullopt;
   return *this;
 }
 
diff --git a/ndn-cxx/mgmt/nfd/face-query-filter.hpp b/ndn-cxx/mgmt/nfd/face-query-filter.hpp
index 7bff9aa..65de800 100644
--- a/ndn-cxx/mgmt/nfd/face-query-filter.hpp
+++ b/ndn-cxx/mgmt/nfd/face-query-filter.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -24,7 +24,8 @@
 
 #include "ndn-cxx/encoding/block.hpp"
 #include "ndn-cxx/encoding/nfd-constants.hpp"
-#include "ndn-cxx/util/optional.hpp"
+
+#include <optional>
 
 namespace ndn {
 namespace nfd {
@@ -204,13 +205,13 @@
   unsetLinkType();
 
 private:
-  optional<uint64_t> m_faceId;
+  std::optional<uint64_t> m_faceId;
   std::string m_uriScheme;
   std::string m_remoteUri;
   std::string m_localUri;
-  optional<FaceScope> m_faceScope;
-  optional<FacePersistency> m_facePersistency;
-  optional<LinkType> m_linkType;
+  std::optional<FaceScope> m_faceScope;
+  std::optional<FacePersistency> m_facePersistency;
+  std::optional<LinkType> m_linkType;
 
   mutable Block m_wire;
 };
diff --git a/ndn-cxx/mgmt/nfd/face-status.cpp b/ndn-cxx/mgmt/nfd/face-status.cpp
index 8727b40..a9b1c00 100644
--- a/ndn-cxx/mgmt/nfd/face-status.cpp
+++ b/ndn-cxx/mgmt/nfd/face-status.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -148,7 +148,7 @@
     ++val;
   }
   else {
-    m_expirationPeriod = nullopt;
+    m_expirationPeriod = std::nullopt;
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceScope) {
@@ -180,7 +180,7 @@
     ++val;
   }
   else {
-    m_baseCongestionMarkingInterval = nullopt;
+    m_baseCongestionMarkingInterval = std::nullopt;
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::DefaultCongestionThreshold) {
@@ -188,7 +188,7 @@
     ++val;
   }
   else {
-    m_defaultCongestionThreshold = nullopt;
+    m_defaultCongestionThreshold = std::nullopt;
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::Mtu) {
@@ -196,7 +196,7 @@
     ++val;
   }
   else {
-    m_mtu = nullopt;
+    m_mtu = std::nullopt;
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInInterests) {
@@ -284,7 +284,7 @@
 FaceStatus::unsetExpirationPeriod()
 {
   m_wire.reset();
-  m_expirationPeriod = nullopt;
+  m_expirationPeriod = std::nullopt;
   return *this;
 }
 
@@ -300,7 +300,7 @@
 FaceStatus::unsetBaseCongestionMarkingInterval()
 {
   m_wire.reset();
-  m_baseCongestionMarkingInterval = nullopt;
+  m_baseCongestionMarkingInterval = std::nullopt;
   return *this;
 }
 
@@ -316,7 +316,7 @@
 FaceStatus::unsetDefaultCongestionThreshold()
 {
   m_wire.reset();
-  m_defaultCongestionThreshold = nullopt;
+  m_defaultCongestionThreshold = std::nullopt;
   return *this;
 }
 
@@ -332,7 +332,7 @@
 FaceStatus::unsetMtu()
 {
   m_wire.reset();
-  m_mtu = nullopt;
+  m_mtu = std::nullopt;
   return *this;
 }
 
diff --git a/ndn-cxx/mgmt/nfd/face-status.hpp b/ndn-cxx/mgmt/nfd/face-status.hpp
index 8d0e59c..893634b 100644
--- a/ndn-cxx/mgmt/nfd/face-status.hpp
+++ b/ndn-cxx/mgmt/nfd/face-status.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -23,9 +23,10 @@
 #define NDN_CXX_MGMT_NFD_FACE_STATUS_HPP
 
 #include "ndn-cxx/mgmt/nfd/face-traits.hpp"
-#include "ndn-cxx/util/optional.hpp"
 #include "ndn-cxx/util/time.hpp"
 
+#include <optional>
+
 namespace ndn {
 namespace nfd {
 
@@ -220,10 +221,10 @@
   setNOutBytes(uint64_t nOutBytes);
 
 private:
-  optional<time::milliseconds> m_expirationPeriod;
-  optional<time::nanoseconds> m_baseCongestionMarkingInterval;
-  optional<uint64_t> m_defaultCongestionThreshold;
-  optional<uint64_t> m_mtu;
+  std::optional<time::milliseconds> m_expirationPeriod;
+  std::optional<time::nanoseconds> m_baseCongestionMarkingInterval;
+  std::optional<uint64_t> m_defaultCongestionThreshold;
+  std::optional<uint64_t> m_mtu;
   uint64_t m_nInInterests;
   uint64_t m_nInData;
   uint64_t m_nInNacks;
diff --git a/ndn-cxx/mgmt/nfd/rib-entry.cpp b/ndn-cxx/mgmt/nfd/rib-entry.cpp
index a3551d0..0356f68 100644
--- a/ndn-cxx/mgmt/nfd/rib-entry.cpp
+++ b/ndn-cxx/mgmt/nfd/rib-entry.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2019 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -94,7 +94,7 @@
 Route&
 Route::unsetExpirationPeriod()
 {
-  m_expirationPeriod = nullopt;
+  m_expirationPeriod = std::nullopt;
   m_wire.reset();
   return *this;
 }
@@ -185,7 +185,7 @@
     ++val;
   }
   else {
-    m_expirationPeriod = nullopt;
+    m_expirationPeriod = std::nullopt;
   }
 }
 
diff --git a/ndn-cxx/mgmt/nfd/rib-entry.hpp b/ndn-cxx/mgmt/nfd/rib-entry.hpp
index 066bbab..c91946f 100644
--- a/ndn-cxx/mgmt/nfd/rib-entry.hpp
+++ b/ndn-cxx/mgmt/nfd/rib-entry.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -122,7 +122,7 @@
   RouteOrigin m_origin;
   uint64_t m_cost;
   uint64_t m_flags;
-  optional<time::milliseconds> m_expirationPeriod;
+  std::optional<time::milliseconds> m_expirationPeriod;
 
   mutable Block m_wire;
 };
diff --git a/ndn-cxx/name.cpp b/ndn-cxx/name.cpp
index 8966281..a72bd8a 100644
--- a/ndn-cxx/name.cpp
+++ b/ndn-cxx/name.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -227,13 +227,13 @@
 }
 
 Name&
-Name::appendVersion(const optional<uint64_t>& version)
+Name::appendVersion(const std::optional<uint64_t>& version)
 {
   return append(Component::fromVersion(version.value_or(time::toUnixTimestamp(time::system_clock::now()).count())));
 }
 
 Name&
-Name::appendTimestamp(const optional<time::system_clock::time_point>& timestamp)
+Name::appendTimestamp(const std::optional<time::system_clock::time_point>& timestamp)
 {
   return append(Component::fromTimestamp(timestamp.value_or(time::system_clock::now())));
 }
diff --git a/ndn-cxx/name.hpp b/ndn-cxx/name.hpp
index 297c1ef..4786bc7 100644
--- a/ndn-cxx/name.hpp
+++ b/ndn-cxx/name.hpp
@@ -23,9 +23,9 @@
 #define NDN_CXX_NAME_HPP
 
 #include "ndn-cxx/name-component.hpp"
-#include "ndn-cxx/util/optional.hpp"
 
 #include <iterator>
+#include <optional>
 
 namespace ndn {
 
@@ -447,7 +447,7 @@
    *     https://named-data.net/publications/techreports/ndn-tr-22-3-ndn-memo-naming-conventions/
    */
   Name&
-  appendVersion(const optional<uint64_t>& version = nullopt);
+  appendVersion(const std::optional<uint64_t>& version = std::nullopt);
 
   /**
    * @brief Append a timestamp component.
@@ -457,7 +457,7 @@
    *     https://named-data.net/publications/techreports/ndn-tr-22-3-ndn-memo-naming-conventions/
    */
   Name&
-  appendTimestamp(const optional<time::system_clock::time_point>& timestamp = nullopt);
+  appendTimestamp(const std::optional<time::system_clock::time_point>& timestamp = std::nullopt);
 
   /**
    * @brief Append a sequence number component.
diff --git a/ndn-cxx/net/impl/link-type-helper-osx.mm b/ndn-cxx/net/impl/link-type-helper-osx.mm
index 048a780..7512259 100644
--- a/ndn-cxx/net/impl/link-type-helper-osx.mm
+++ b/ndn-cxx/net/impl/link-type-helper-osx.mm
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -20,6 +20,7 @@
  */
 
 #include "ndn-cxx/net/impl/link-type-helper.hpp"
+#include "ndn-cxx/detail/config.hpp"
 
 #ifndef NDN_CXX_HAVE_OSX_FRAMEWORKS
 #error "This file should not be compiled ..."
diff --git a/ndn-cxx/net/impl/link-type-helper.hpp b/ndn-cxx/net/impl/link-type-helper.hpp
index de4dfc6..e5bdc23 100644
--- a/ndn-cxx/net/impl/link-type-helper.hpp
+++ b/ndn-cxx/net/impl/link-type-helper.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -24,6 +24,8 @@
 
 #include "ndn-cxx/encoding/nfd-constants.hpp"
 
+#include <string>
+
 namespace ndn {
 namespace net {
 namespace detail {
diff --git a/ndn-cxx/net/impl/netlink-message.hpp b/ndn-cxx/net/impl/netlink-message.hpp
index dc80320..ba88856 100644
--- a/ndn-cxx/net/impl/netlink-message.hpp
+++ b/ndn-cxx/net/impl/netlink-message.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -26,7 +26,6 @@
 
 #include "ndn-cxx/detail/common.hpp"
 #include "ndn-cxx/net/ethernet.hpp"
-#include "ndn-cxx/util/optional.hpp"
 
 #ifndef NDN_CXX_HAVE_NETLINK
 #error "This file should not be included ..."
@@ -38,6 +37,7 @@
 
 #include <cstring>
 #include <map>
+#include <optional>
 
 #include <boost/asio/ip/address.hpp>
 
@@ -227,12 +227,12 @@
   }
 
   template<typename U>
-  optional<U>
+  std::optional<U>
   getAttributeByType(uint16_t attrType) const
   {
     auto it = m_attrs.find(attrType);
     if (it == m_attrs.end())
-      return nullopt;
+      return std::nullopt;
 
     return convertAttrValue(getAttributeValue(it->second),
                             getAttributeValueLength(it->second),
@@ -261,48 +261,48 @@
   }
 
   template<typename Integral>
-  static std::enable_if_t<std::is_integral<Integral>::value, optional<Integral>>
+  static std::enable_if_t<std::is_integral<Integral>::value, std::optional<Integral>>
   convertAttrValue(const uint8_t* val, size_t len, AttrValueTypeTag<Integral>)
   {
     if (len < sizeof(Integral))
-      return nullopt;
+      return std::nullopt;
 
     Integral i;
     std::memcpy(&i, val, sizeof(Integral));
     return i;
   }
 
-  static optional<std::string>
+  static std::optional<std::string>
   convertAttrValue(const uint8_t* val, size_t len, AttrValueTypeTag<std::string>)
   {
     auto str = reinterpret_cast<const char*>(val);
     if (::strnlen(str, len) >= len)
-      return nullopt;
+      return std::nullopt;
 
-    return std::string(str);
+    return std::make_optional<std::string>(str);
   }
 
-  static optional<ethernet::Address>
+  static std::optional<ethernet::Address>
   convertAttrValue(const uint8_t* val, size_t len, AttrValueTypeTag<ethernet::Address>)
   {
     if (len < ethernet::ADDR_LEN)
-      return nullopt;
+      return std::nullopt;
 
-    return ethernet::Address(val);
+    return std::make_optional<ethernet::Address>(val);
   }
 
   template<typename IpAddress>
   static std::enable_if_t<std::is_same<IpAddress, boost::asio::ip::address_v4>::value ||
                           std::is_same<IpAddress, boost::asio::ip::address_v6>::value,
-                          optional<IpAddress>>
+                          std::optional<IpAddress>>
   convertAttrValue(const uint8_t* val, size_t len, AttrValueTypeTag<IpAddress>)
   {
     typename IpAddress::bytes_type bytes;
     if (len < bytes.size())
-      return nullopt;
+      return std::nullopt;
 
     std::copy_n(val, bytes.size(), bytes.begin());
-    return IpAddress(bytes);
+    return std::make_optional<IpAddress>(bytes);
   }
 
 private:
diff --git a/ndn-cxx/prefix-announcement.cpp b/ndn-cxx/prefix-announcement.cpp
index d5a0049..decb314 100644
--- a/ndn-cxx/prefix-announcement.cpp
+++ b/ndn-cxx/prefix-announcement.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -68,7 +68,7 @@
 
 const Data&
 PrefixAnnouncement::toData(KeyChain& keyChain, const ndn::security::SigningInfo& si,
-                           optional<uint64_t> version) const
+                           std::optional<uint64_t> version) const
 {
   if (!m_data) {
     Name dataName = m_announcedName;
@@ -112,7 +112,7 @@
 }
 
 PrefixAnnouncement&
-PrefixAnnouncement::setValidityPeriod(optional<security::ValidityPeriod> validity)
+PrefixAnnouncement::setValidityPeriod(std::optional<security::ValidityPeriod> validity)
 {
   m_data.reset();
   m_validity = std::move(validity);
diff --git a/ndn-cxx/prefix-announcement.hpp b/ndn-cxx/prefix-announcement.hpp
index ed9ea0d..11c29bd 100644
--- a/ndn-cxx/prefix-announcement.hpp
+++ b/ndn-cxx/prefix-announcement.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -58,7 +58,7 @@
 
   /** \brief Get the Data representing the prefix announcement, if available.
    */
-  const optional<Data>&
+  const std::optional<Data>&
   getData() const
   {
     return m_data;
@@ -74,7 +74,7 @@
   const Data&
   toData(KeyChain& keyChain,
          const ndn::security::SigningInfo& si = security::SigningInfo(),
-         optional<uint64_t> version = nullopt) const;
+         std::optional<uint64_t> version = std::nullopt) const;
 
   /** \brief Return announced name.
    */
@@ -107,7 +107,7 @@
 
   /** \brief Return absolute validity period.
    */
-  optional<security::ValidityPeriod>
+  std::optional<security::ValidityPeriod>
   getValidityPeriod() const
   {
     return m_validity;
@@ -117,7 +117,7 @@
    *  \post getData() == nullopt
    */
   PrefixAnnouncement&
-  setValidityPeriod(optional<security::ValidityPeriod> validity);
+  setValidityPeriod(std::optional<security::ValidityPeriod> validity);
 
 public: // static methods
   /**
@@ -127,10 +127,10 @@
   getKeywordComponent();
 
 private:
-  mutable optional<Data> m_data;
+  mutable std::optional<Data> m_data;
   Name m_announcedName;
   time::milliseconds m_expiration = 0_ms;
-  optional<security::ValidityPeriod> m_validity;
+  std::optional<security::ValidityPeriod> m_validity;
 };
 
 /**
diff --git a/ndn-cxx/security/impl/openssl-helper.cpp b/ndn-cxx/security/impl/openssl-helper.cpp
index c9c0cbf..0b14fa1 100644
--- a/ndn-cxx/security/impl/openssl-helper.cpp
+++ b/ndn-cxx/security/impl/openssl-helper.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -21,6 +21,8 @@
 
 #include "ndn-cxx/security/impl/openssl-helper.hpp"
 
+#include <limits>
+
 namespace ndn {
 namespace security {
 namespace detail {
diff --git a/ndn-cxx/security/key-chain.cpp b/ndn-cxx/security/key-chain.cpp
index dd30d73..98b7080 100644
--- a/ndn-cxx/security/key-chain.cpp
+++ b/ndn-cxx/security/key-chain.cpp
@@ -733,7 +733,7 @@
 
 std::tuple<Name, SignatureInfo>
 KeyChain::prepareSignatureInfoWithKey(const SigningInfo& params, const pib::Key& key,
-                                      const optional<Name>& certName)
+                                      const std::optional<Name>& certName)
 {
   auto sigInfo = params.getSignatureInfo();
   sigInfo.setSignatureType(getSignatureType(key.getKeyType(), params.getDigestAlgorithm()));
diff --git a/ndn-cxx/security/key-chain.hpp b/ndn-cxx/security/key-chain.hpp
index 5e2f31a..1740bb0 100644
--- a/ndn-cxx/security/key-chain.hpp
+++ b/ndn-cxx/security/key-chain.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -50,7 +50,7 @@
    *
    * Default is deriving from current timestamp using the logic of Name::appendVersion() .
    */
-  optional<uint64_t> version;
+  std::optional<uint64_t> version;
 
   /**
    * @brief Certificate packet FreshnessPeriod.
@@ -70,7 +70,7 @@
    *
    * Default is a ValidityPeriod from now until 365 days later.
    */
-  optional<ValidityPeriod> validity;
+  std::optional<ValidityPeriod> validity;
 };
 
 inline namespace v2 {
@@ -498,7 +498,7 @@
 
   static std::tuple<Name, SignatureInfo>
   prepareSignatureInfoWithKey(const SigningInfo& params, const pib::Key& key,
-                              const optional<Name>& certName = nullopt);
+                              const std::optional<Name>& certName = std::nullopt);
 
   /**
    * @brief Generate and return a raw signature for the byte ranges in @p bufs using
diff --git a/ndn-cxx/security/pib/impl/key-impl.cpp b/ndn-cxx/security/pib/impl/key-impl.cpp
index f308099..23b6303 100644
--- a/ndn-cxx/security/pib/impl/key-impl.cpp
+++ b/ndn-cxx/security/pib/impl/key-impl.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -71,7 +71,7 @@
 
   if (m_defaultCert && m_defaultCert->getName() == certName) {
     NDN_LOG_DEBUG("Removing default certificate " << certName);
-    m_defaultCert = nullopt;
+    m_defaultCert = std::nullopt;
   }
   m_certificates.remove(certName);
 }
diff --git a/ndn-cxx/security/pib/impl/key-impl.hpp b/ndn-cxx/security/pib/impl/key-impl.hpp
index 172d103..b6d73c6 100644
--- a/ndn-cxx/security/pib/impl/key-impl.hpp
+++ b/ndn-cxx/security/pib/impl/key-impl.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -131,7 +131,7 @@
   const shared_ptr<PibImpl> m_pib;
 
   CertificateContainer m_certificates;
-  mutable optional<Certificate> m_defaultCert;
+  mutable std::optional<Certificate> m_defaultCert;
 };
 
 } // namespace detail
diff --git a/ndn-cxx/security/pib/impl/pib-memory.hpp b/ndn-cxx/security/pib/impl/pib-memory.hpp
index 74abea3..a2e7abd 100644
--- a/ndn-cxx/security/pib/impl/pib-memory.hpp
+++ b/ndn-cxx/security/pib/impl/pib-memory.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -127,7 +127,7 @@
   std::string m_tpmLocator;
 
   std::set<Name> m_identities;
-  optional<Name> m_defaultIdentity;
+  std::optional<Name> m_defaultIdentity;
 
   /// identity name => default key name
   std::map<Name, Name> m_defaultKeys;
diff --git a/ndn-cxx/security/validation-policy-signed-interest.cpp b/ndn-cxx/security/validation-policy-signed-interest.cpp
index 3ddab05..efaf82a 100644
--- a/ndn-cxx/security/validation-policy-signed-interest.cpp
+++ b/ndn-cxx/security/validation-policy-signed-interest.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -142,9 +142,9 @@
 
 void
 ValidationPolicySignedInterest::insertRecord(const Name& keyName,
-                                             optional<time::system_clock::TimePoint> timestamp,
-                                             optional<uint64_t> seqNum,
-                                             optional<SigNonce> nonce)
+                                             std::optional<time::system_clock::TimePoint> timestamp,
+                                             std::optional<uint64_t> seqNum,
+                                             std::optional<SigNonce> nonce)
 {
   // If key record exists, update last refreshed time. Otherwise, create new record.
   Container::nth_index<0>::type::iterator it;
diff --git a/ndn-cxx/security/validation-policy-signed-interest.hpp b/ndn-cxx/security/validation-policy-signed-interest.hpp
index a600c00..92365cd 100644
--- a/ndn-cxx/security/validation-policy-signed-interest.hpp
+++ b/ndn-cxx/security/validation-policy-signed-interest.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -158,9 +158,9 @@
 
   void
   insertRecord(const Name& keyName,
-               optional<time::system_clock::TimePoint> timestamp,
-               optional<uint64_t> seqNum,
-               optional<SigNonce> nonce);
+               std::optional<time::system_clock::TimePoint> timestamp,
+               std::optional<uint64_t> seqNum,
+               std::optional<SigNonce> nonce);
 
 private:
   Options m_options;
@@ -181,8 +181,8 @@
   struct LastInterestRecord
   {
     LastInterestRecord(const Name& keyName,
-                       optional<time::system_clock::TimePoint> timestamp,
-                       optional<uint64_t> seqNum)
+                       std::optional<time::system_clock::TimePoint> timestamp,
+                       std::optional<uint64_t> seqNum)
       : keyName(keyName)
       , timestamp(timestamp)
       , seqNum(seqNum)
@@ -191,8 +191,8 @@
     }
 
     Name keyName;
-    optional<time::system_clock::TimePoint> timestamp;
-    optional<uint64_t> seqNum;
+    std::optional<time::system_clock::TimePoint> timestamp;
+    std::optional<uint64_t> seqNum;
     NonceContainer observedNonces;
     time::steady_clock::TimePoint lastRefreshed;
   };
diff --git a/ndn-cxx/security/validation-state.cpp b/ndn-cxx/security/validation-state.cpp
index e917fbc..6fa2c96 100644
--- a/ndn-cxx/security/validation-state.cpp
+++ b/ndn-cxx/security/validation-state.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -92,7 +92,7 @@
 }
 
 void
-DataValidationState::verifyOriginalPacket(const optional<Certificate>& trustedCert)
+DataValidationState::verifyOriginalPacket(const std::optional<Certificate>& trustedCert)
 {
   if (verifySignature(m_data, trustedCert)) {
     NDN_LOG_TRACE_DEPTH("OK signature for data `" << m_data.getName() << "`");
@@ -145,7 +145,7 @@
 }
 
 void
-InterestValidationState::verifyOriginalPacket(const optional<Certificate>& trustedCert)
+InterestValidationState::verifyOriginalPacket(const std::optional<Certificate>& trustedCert)
 {
   if (verifySignature(m_interest, trustedCert)) {
     NDN_LOG_TRACE_DEPTH("OK signature for interest `" << m_interest.getName() << "`");
diff --git a/ndn-cxx/security/validation-state.hpp b/ndn-cxx/security/validation-state.hpp
index 15ea8f1..de16915 100644
--- a/ndn-cxx/security/validation-state.hpp
+++ b/ndn-cxx/security/validation-state.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -106,12 +106,12 @@
   /**
    * @brief Verify signature of the original packet
    *
-   * @param trustCert The certificate that signs the original packet, nullopt if certificate is
-   *                  not needed for verification (e.g., sha256 digest or attribute based
-   *                  signature)
+   * @param trustedCert The certificate that signs the original packet, nullopt if certificate
+   *                    is not needed for verification (e.g., sha256 digest or attribute based
+   *                    signature)
    */
   virtual void
-  verifyOriginalPacket(const optional<Certificate>& trustedCert) = 0;
+  verifyOriginalPacket(const std::optional<Certificate>& trustedCert) = 0;
 
   /**
    * @brief Call success callback of the original packet without signature validation
@@ -191,7 +191,7 @@
 
 private:
   void
-  verifyOriginalPacket(const optional<Certificate>& trustedCert) final;
+  verifyOriginalPacket(const std::optional<Certificate>& trustedCert) final;
 
   void
   bypassValidation() final;
@@ -243,7 +243,7 @@
 
 private:
   void
-  verifyOriginalPacket(const optional<Certificate>& trustedCert) final;
+  verifyOriginalPacket(const std::optional<Certificate>& trustedCert) final;
 
   void
   bypassValidation() final;
diff --git a/ndn-cxx/security/validator.cpp b/ndn-cxx/security/validator.cpp
index 99d1a6f..fd9817f 100644
--- a/ndn-cxx/security/validator.cpp
+++ b/ndn-cxx/security/validator.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -129,7 +129,7 @@
   }
 
   if (certRequest->interest.getName() == SigningInfo::getDigestSha256Identity()) {
-    state->verifyOriginalPacket(nullopt);
+    state->verifyOriginalPacket(std::nullopt);
     return;
   }
 
diff --git a/ndn-cxx/security/verification-helpers.cpp b/ndn-cxx/security/verification-helpers.cpp
index 553b45b..0a339f3 100644
--- a/ndn-cxx/security/verification-helpers.cpp
+++ b/ndn-cxx/security/verification-helpers.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -216,7 +216,7 @@
 }
 
 bool
-verifySignature(const Data& data, const optional<Certificate>& cert)
+verifySignature(const Data& data, const std::optional<Certificate>& cert)
 {
   auto parsed = parse(data);
   if (cert) {
@@ -232,7 +232,7 @@
 }
 
 bool
-verifySignature(const Interest& interest, const optional<Certificate>& cert)
+verifySignature(const Interest& interest, const std::optional<Certificate>& cert)
 {
   auto parsed = parse(interest);
   if (cert) {
diff --git a/ndn-cxx/security/verification-helpers.hpp b/ndn-cxx/security/verification-helpers.hpp
index 26cc824..ee8c9ec 100644
--- a/ndn-cxx/security/verification-helpers.hpp
+++ b/ndn-cxx/security/verification-helpers.hpp
@@ -108,7 +108,7 @@
  * If @p cert is nullopt, @p data assumed to be self-verifiable (with digest or attributes)
  */
 [[nodiscard]] bool
-verifySignature(const Data& data, const optional<Certificate>& cert);
+verifySignature(const Data& data, const std::optional<Certificate>& cert);
 
 /**
  * @brief Verify @p interest using @p cert.
@@ -117,7 +117,7 @@
  * If @p cert is nullptr, @p interest assumed to be self-verifiable (with digest or attributes)
  */
 [[nodiscard]] bool
-verifySignature(const Interest& interest, const optional<Certificate>& cert);
+verifySignature(const Interest& interest, const std::optional<Certificate>& cert);
 
 /**
  * @brief Verify @p data using @p tpm and @p keyName with the @p digestAlgorithm.
diff --git a/ndn-cxx/signature-info.cpp b/ndn-cxx/signature-info.cpp
index fb062d4..0e8eed4 100644
--- a/ndn-cxx/signature-info.cpp
+++ b/ndn-cxx/signature-info.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -37,7 +37,7 @@
 
 SignatureInfo::SignatureInfo() = default;
 
-SignatureInfo::SignatureInfo(tlv::SignatureTypeValue type, optional<KeyLocator> keyLocator)
+SignatureInfo::SignatureInfo(tlv::SignatureTypeValue type, std::optional<KeyLocator> keyLocator)
   : m_type(type)
   , m_keyLocator(std::move(keyLocator))
 {
@@ -117,7 +117,7 @@
 SignatureInfo::wireDecode(const Block& wire, SignatureInfo::Type type)
 {
   m_type = -1;
-  m_keyLocator = nullopt;
+  m_keyLocator = std::nullopt;
   m_otherTlvs.clear();
 
   m_wire = wire;
@@ -196,7 +196,7 @@
 }
 
 SignatureInfo&
-SignatureInfo::setKeyLocator(optional<KeyLocator> keyLocator)
+SignatureInfo::setKeyLocator(std::optional<KeyLocator> keyLocator)
 {
   if (keyLocator != m_keyLocator) {
     m_keyLocator = std::move(keyLocator);
@@ -216,7 +216,7 @@
 }
 
 SignatureInfo&
-SignatureInfo::setValidityPeriod(optional<security::ValidityPeriod> validityPeriod)
+SignatureInfo::setValidityPeriod(std::optional<security::ValidityPeriod> validityPeriod)
 {
   if (!validityPeriod) {
     removeCustomTlv(tlv::ValidityPeriod);
@@ -227,18 +227,18 @@
   return *this;
 }
 
-optional<std::vector<uint8_t>>
+std::optional<std::vector<uint8_t>>
 SignatureInfo::getNonce() const
 {
   auto it = findOtherTlv(tlv::SignatureNonce);
   if (it == m_otherTlvs.end()) {
-    return nullopt;
+    return std::nullopt;
   }
   return std::vector<uint8_t>(it->value_begin(), it->value_end());
 }
 
 SignatureInfo&
-SignatureInfo::setNonce(optional<span<const uint8_t>> nonce)
+SignatureInfo::setNonce(std::optional<span<const uint8_t>> nonce)
 {
   if (!nonce) {
     removeCustomTlv(tlv::SignatureNonce);
@@ -249,18 +249,18 @@
   return *this;
 }
 
-optional<time::system_clock::time_point>
+std::optional<time::system_clock::time_point>
 SignatureInfo::getTime() const
 {
   auto it = findOtherTlv(tlv::SignatureTime);
   if (it == m_otherTlvs.end()) {
-    return nullopt;
+    return std::nullopt;
   }
   return time::fromUnixTimestamp(time::milliseconds(readNonNegativeInteger(*it)));
 }
 
 SignatureInfo&
-SignatureInfo::setTime(optional<time::system_clock::time_point> time)
+SignatureInfo::setTime(std::optional<time::system_clock::time_point> time)
 {
   if (!time) {
     removeCustomTlv(tlv::SignatureTime);
@@ -272,18 +272,18 @@
   return *this;
 }
 
-optional<uint64_t>
+std::optional<uint64_t>
 SignatureInfo::getSeqNum() const
 {
   auto it = findOtherTlv(tlv::SignatureSeqNum);
   if (it == m_otherTlvs.end()) {
-    return nullopt;
+    return std::nullopt;
   }
   return readNonNegativeInteger(*it);
 }
 
 SignatureInfo&
-SignatureInfo::setSeqNum(optional<uint64_t> seqNum)
+SignatureInfo::setSeqNum(std::optional<uint64_t> seqNum)
 {
   if (!seqNum) {
     removeCustomTlv(tlv::SignatureSeqNum);
@@ -294,12 +294,12 @@
   return *this;
 }
 
-optional<Block>
+std::optional<Block>
 SignatureInfo::getCustomTlv(uint32_t type) const
 {
   auto it = findOtherTlv(type);
   if (it == m_otherTlvs.end()) {
-    return nullopt;
+    return std::nullopt;
   }
   return *it;
 }
diff --git a/ndn-cxx/signature-info.hpp b/ndn-cxx/signature-info.hpp
index afb3ff5..134bc46 100644
--- a/ndn-cxx/signature-info.hpp
+++ b/ndn-cxx/signature-info.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -50,7 +50,7 @@
   /** @brief Create with the specified type and KeyLocator
    */
   explicit
-  SignatureInfo(tlv::SignatureTypeValue type, optional<KeyLocator> keyLocator = nullopt);
+  SignatureInfo(tlv::SignatureTypeValue type, std::optional<KeyLocator> keyLocator = std::nullopt);
 
   /** @brief Create from wire encoding
    *  @param wire Wire to decode from
@@ -143,7 +143,7 @@
    *  @return A reference to this SignatureInfo, to allow chaining.
    */
   SignatureInfo&
-  setKeyLocator(optional<KeyLocator> keyLocator);
+  setKeyLocator(std::optional<KeyLocator> keyLocator);
 
   /** @brief Get the `ValidityPeriod` element.
    *  @throw Error This SignatureInfo does not contain a ValidityPeriod
@@ -158,12 +158,12 @@
    *  @return A reference to this SignatureInfo, to allow chaining.
    */
   SignatureInfo&
-  setValidityPeriod(optional<security::ValidityPeriod> validityPeriod);
+  setValidityPeriod(std::optional<security::ValidityPeriod> validityPeriod);
 
   /** @brief Get SignatureNonce
    *  @retval nullopt SignatureNonce is not set
    */
-  optional<std::vector<uint8_t>>
+  std::optional<std::vector<uint8_t>>
   getNonce() const;
 
   /** @brief Append or replace SignatureNonce
@@ -173,12 +173,12 @@
    *  @return A reference to this SignatureInfo, to allow chaining.
    */
   SignatureInfo&
-  setNonce(optional<span<const uint8_t>> nonce);
+  setNonce(std::optional<span<const uint8_t>> nonce);
 
   /** @brief Get SignatureTime
    *  @retval nullopt SignatureTime is not set
    */
-  optional<time::system_clock::time_point>
+  std::optional<time::system_clock::time_point>
   getTime() const;
 
   /** @brief Append or replace SignatureTime
@@ -188,12 +188,12 @@
    *  @return A reference to this SignatureInfo, to allow chaining.
    */
   SignatureInfo&
-  setTime(optional<time::system_clock::time_point> time = time::system_clock::now());
+  setTime(std::optional<time::system_clock::time_point> time = time::system_clock::now());
 
   /** @brief Get SignatureSeqNum
    *  @retval nullopt SignatureSeqNum is not set
    */
-  optional<uint64_t>
+  std::optional<uint64_t>
   getSeqNum() const;
 
   /** @brief Append or replace SignatureSeqNum
@@ -203,13 +203,13 @@
    *  @return A reference to this SignatureInfo, to allow chaining.
    */
   SignatureInfo&
-  setSeqNum(optional<uint64_t> seqNum);
+  setSeqNum(std::optional<uint64_t> seqNum);
 
   /** @brief Get first custom TLV element with the specified TLV-TYPE
    *  @param type TLV-TYPE of element to get
    *  @retval nullopt No custom TLV elements with the specified TLV-TYPE exist
    */
-  optional<Block>
+  std::optional<Block>
   getCustomTlv(uint32_t type) const;
 
   /** @brief Append an arbitrary TLV element to this SignatureInfo
@@ -231,7 +231,7 @@
 
 private:
   int32_t m_type = -1;
-  optional<KeyLocator> m_keyLocator;
+  std::optional<KeyLocator> m_keyLocator;
   std::vector<Block> m_otherTlvs;
 
   mutable Block m_wire;
diff --git a/ndn-cxx/util/io.hpp b/ndn-cxx/util/io.hpp
index 52c7814..4eb321b 100644
--- a/ndn-cxx/util/io.hpp
+++ b/ndn-cxx/util/io.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -24,7 +24,6 @@
 
 #include "ndn-cxx/encoding/block.hpp"
 #include "ndn-cxx/util/concepts.hpp"
-#include "ndn-cxx/util/optional.hpp"
 
 #include <fstream>
 
diff --git a/ndn-cxx/util/optional.hpp b/ndn-cxx/util/optional.hpp
deleted file mode 100644
index 9113ead..0000000
--- a/ndn-cxx/util/optional.hpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2022 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#ifndef NDN_CXX_UTIL_OPTIONAL_HPP
-#define NDN_CXX_UTIL_OPTIONAL_HPP
-
-#define optional_CONFIG_SELECT_OPTIONAL optional_OPTIONAL_NONSTD
-#define optional_CONFIG_NO_EXTENSIONS 1
-#include "ndn-cxx/detail/nonstd/optional-lite.hpp"
-
-namespace ndn {
-
-using ::nonstd::optional;
-using ::nonstd::bad_optional_access;
-using ::nonstd::nullopt;
-using ::nonstd::nullopt_t;
-using ::nonstd::make_optional;
-
-using ::nonstd::in_place;
-using ::nonstd::in_place_t;
-
-} // namespace ndn
-
-#endif // NDN_CXX_UTIL_OPTIONAL_HPP
diff --git a/ndn-cxx/util/time.hpp b/ndn-cxx/util/time.hpp
index 7792faa..b4ffd53 100644
--- a/ndn-cxx/util/time.hpp
+++ b/ndn-cxx/util/time.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -27,6 +27,8 @@
 #include <boost/asio/wait_traits.hpp>
 #include <boost/chrono.hpp>
 
+#include <limits>
+
 namespace ndn {
 namespace time {
 
diff --git a/tests/test-common.cpp b/tests/test-common.cpp
index 7041406..b0d06ea 100644
--- a/tests/test-common.cpp
+++ b/tests/test-common.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -25,8 +25,8 @@
 namespace tests {
 
 shared_ptr<Interest>
-makeInterest(const Name& name, bool canBePrefix, optional<time::milliseconds> lifetime,
-             optional<Interest::Nonce> nonce)
+makeInterest(const Name& name, bool canBePrefix, std::optional<time::milliseconds> lifetime,
+             std::optional<Interest::Nonce> nonce)
 {
   auto interest = std::make_shared<Interest>(name);
   interest->setCanBePrefix(canBePrefix);
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index f7f58a3..7b74f35 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -35,8 +35,8 @@
  */
 shared_ptr<Interest>
 makeInterest(const Name& name, bool canBePrefix = false,
-             optional<time::milliseconds> lifetime = nullopt,
-             optional<Interest::Nonce> nonce = nullopt);
+             std::optional<time::milliseconds> lifetime = std::nullopt,
+             std::optional<Interest::Nonce> nonce = std::nullopt);
 
 /**
  * \brief Create a Data with a null (i.e., empty) signature
@@ -70,7 +70,7 @@
 
 /**
  * \brief Replace a name component in a packet
- * \param[inout] pkt the packet
+ * \param[in,out] pkt the packet
  * \param index the index of the name component to replace
  * \param args arguments to name::Component constructor
  */
diff --git a/tests/unit/face.t.cpp b/tests/unit/face.t.cpp
index 5fdfd1c..0ee95b4 100644
--- a/tests/unit/face.t.cpp
+++ b/tests/unit/face.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -427,14 +427,14 @@
 
   BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
 
-  face.put(makeNack(*makeInterest("/unsolicited", false, nullopt, 18645250),
+  face.put(makeNack(*makeInterest("/unsolicited", false, std::nullopt, 18645250),
                     lp::NackReason::NO_ROUTE));
   advanceClocks(10_ms);
   BOOST_CHECK_EQUAL(face.sentNacks.size(), 0); // unsolicited Nack would not be sent
 
-  auto interest1 = makeInterest("/Hello/World", false, nullopt, 14247162);
+  auto interest1 = makeInterest("/Hello/World", false, std::nullopt, 14247162);
   face.receive(*interest1);
-  auto interest2 = makeInterest("/another/prefix", false, nullopt, 92203002);
+  auto interest2 = makeInterest("/another/prefix", false, std::nullopt, 92203002);
   face.receive(*interest2);
   advanceClocks(10_ms);
 
@@ -465,7 +465,7 @@
   face.setInterestFilter("/", bind([&] { hasInterest2 = true; }));
   advanceClocks(10_ms);
 
-  auto interest = makeInterest("/A", false, nullopt, 14333271);
+  auto interest = makeInterest("/A", false, std::nullopt, 14333271);
   face.receive(*interest);
   advanceClocks(10_ms);
   BOOST_CHECK(hasInterest1);
@@ -496,7 +496,7 @@
   face.setInterestFilter(InterestFilter("/").allowLoopback(false),
     bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
 
-  auto interest = makeInterest("/A", false, nullopt, 28395852);
+  auto interest = makeInterest("/A", false, std::nullopt, 28395852);
   face.expressInterest(*interest,
                        bind([] { BOOST_FAIL("Unexpected data"); }),
                        [&] (const Interest&, const lp::Nack& nack) {
diff --git a/tests/unit/interest.t.cpp b/tests/unit/interest.t.cpp
index 9e71cfb..684f097 100644
--- a/tests/unit/interest.t.cpp
+++ b/tests/unit/interest.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -57,11 +57,11 @@
   BOOST_CHECK_EQUAL(i.getForwardingHint().empty(), true);
   BOOST_CHECK_EQUAL(i.hasNonce(), false);
   BOOST_CHECK_EQUAL(i.getInterestLifetime(), DEFAULT_INTEREST_LIFETIME);
-  BOOST_CHECK(i.getHopLimit() == nullopt);
+  BOOST_CHECK(i.getHopLimit() == std::nullopt);
   BOOST_CHECK_EQUAL(i.hasApplicationParameters(), false);
   BOOST_CHECK_EQUAL(i.getApplicationParameters().isValid(), false);
   BOOST_CHECK_EQUAL(i.isParametersDigestValid(), true);
-  BOOST_CHECK(i.getSignatureInfo() == nullopt);
+  BOOST_CHECK(i.getSignatureInfo() == std::nullopt);
   BOOST_CHECK_EQUAL(i.getSignatureValue().isValid(), false);
   BOOST_CHECK_EQUAL(i.isSigned(), false);
 }
@@ -96,10 +96,10 @@
   BOOST_CHECK_EQUAL(i2.hasNonce(), true);
   BOOST_CHECK_EQUAL(i2.getNonce(), 0x01020304);
   BOOST_CHECK_EQUAL(i2.getInterestLifetime(), DEFAULT_INTEREST_LIFETIME);
-  BOOST_CHECK(i2.getHopLimit() == nullopt);
+  BOOST_CHECK(i2.getHopLimit() == std::nullopt);
   BOOST_CHECK_EQUAL(i2.hasApplicationParameters(), false);
   BOOST_CHECK_EQUAL(i2.getApplicationParameters().isValid(), false);
-  BOOST_CHECK(i2.getSignatureInfo() == nullopt);
+  BOOST_CHECK(i2.getSignatureInfo() == std::nullopt);
   BOOST_CHECK_EQUAL(i2.getSignatureValue().isValid(), false);
   BOOST_CHECK_EQUAL(i2.isSigned(), false);
 }
@@ -140,10 +140,10 @@
   BOOST_CHECK_EQUAL(i2.hasNonce(), true);
   BOOST_CHECK_EQUAL(i2.getNonce(), 0x1);
   BOOST_CHECK_EQUAL(i2.getInterestLifetime(), DEFAULT_INTEREST_LIFETIME);
-  BOOST_CHECK(i2.getHopLimit() == nullopt);
+  BOOST_CHECK(i2.getHopLimit() == std::nullopt);
   BOOST_CHECK_EQUAL(i2.hasApplicationParameters(), true);
   BOOST_CHECK_EQUAL(i2.getApplicationParameters(), "2404C0C1C2C3"_block);
-  BOOST_CHECK(i2.getSignatureInfo() == nullopt);
+  BOOST_CHECK(i2.getSignatureInfo() == std::nullopt);
   BOOST_CHECK_EQUAL(i2.getSignatureValue().isValid(), false);
   BOOST_CHECK_EQUAL(i2.isSigned(), false);
 }
@@ -402,7 +402,7 @@
   BOOST_CHECK_EQUAL(i.getForwardingHint().empty(), true);
   BOOST_CHECK_EQUAL(i.hasNonce(), false);
   BOOST_CHECK_EQUAL(i.getInterestLifetime(), DEFAULT_INTEREST_LIFETIME);
-  BOOST_CHECK(i.getHopLimit() == nullopt);
+  BOOST_CHECK(i.getHopLimit() == std::nullopt);
   BOOST_CHECK_EQUAL(i.hasApplicationParameters(), false);
   BOOST_CHECK_EQUAL(i.getApplicationParameters().isValid(), false);
 
@@ -422,7 +422,7 @@
   BOOST_CHECK_EQUAL(i.getForwardingHint().empty(), true);
   BOOST_CHECK_EQUAL(i.hasNonce(), false);
   BOOST_CHECK_EQUAL(i.getInterestLifetime(), DEFAULT_INTEREST_LIFETIME);
-  BOOST_CHECK(i.getHopLimit() == nullopt);
+  BOOST_CHECK(i.getHopLimit() == std::nullopt);
   BOOST_CHECK_EQUAL(i.hasApplicationParameters(), false);
   BOOST_CHECK_EQUAL(i.getApplicationParameters().isValid(), false);
 }
@@ -789,7 +789,7 @@
   BOOST_CHECK_EQUAL(i2.getNonce(), 2);
   BOOST_CHECK_EQUAL(i1.getNonce(), 1); // should not affect i1's Nonce (Bug #4168)
 
-  i2.setNonce(nullopt);
+  i2.setNonce(std::nullopt);
   BOOST_CHECK(!i2.hasNonce());
 }
 
@@ -852,11 +852,11 @@
 BOOST_AUTO_TEST_CASE(SetHopLimit)
 {
   Interest i;
-  BOOST_CHECK(i.getHopLimit() == nullopt);
+  BOOST_CHECK(i.getHopLimit() == std::nullopt);
   i.setHopLimit(42);
   BOOST_CHECK(i.getHopLimit() == 42);
-  i.setHopLimit(nullopt);
-  BOOST_CHECK(i.getHopLimit() == nullopt);
+  i.setHopLimit(std::nullopt);
+  BOOST_CHECK(i.getHopLimit() == std::nullopt);
 }
 
 BOOST_AUTO_TEST_CASE(SetApplicationParameters)
@@ -901,7 +901,7 @@
     return e.what() == "InterestSignatureInfo must be present to set InterestSignatureValue"s;
   });
 
-  BOOST_CHECK(i.getSignatureInfo() == nullopt);
+  BOOST_CHECK(i.getSignatureInfo() == std::nullopt);
   BOOST_CHECK_EQUAL(i.getSignatureValue().isValid(), false);
   BOOST_CHECK_EQUAL(i.isSigned(), false);
 
@@ -1010,7 +1010,7 @@
   BOOST_CHECK(i.getSignatureInfo() == si);
 
   i.unsetApplicationParameters(); // removes ParametersSha256DigestComponent and InterestSignatureInfo
-  BOOST_CHECK(i.getSignatureInfo() == nullopt);
+  BOOST_CHECK(i.getSignatureInfo() == std::nullopt);
   BOOST_CHECK_EQUAL(i.getSignatureValue().isValid(), false);
   BOOST_CHECK_EQUAL(i.getName(), "/A/B/C");
 
@@ -1157,7 +1157,7 @@
 
   i.setCanBePrefix(false);
   i.setMustBeFresh(false);
-  i.setHopLimit(nullopt);
+  i.setHopLimit(std::nullopt);
   i.setApplicationParameters("2402CAFE"_block);
   BOOST_CHECK_EQUAL(i.toUri(),
                     "/foo/params-sha256=8621f5e8321f04104640c8d02877d7c5142cad6e203c5effda1783b1a0e476d6"
diff --git a/tests/unit/meta-info.t.cpp b/tests/unit/meta-info.t.cpp
index af8416a..19fa2d3 100644
--- a/tests/unit/meta-info.t.cpp
+++ b/tests/unit/meta-info.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "ndn-cxx/meta-info.hpp"
-#include "ndn-cxx/data.hpp"
 
 #include "tests/boost-test.hpp"
 
@@ -35,7 +34,7 @@
   MetaInfo a("1406 type=180100 freshness=190100"_block);
   BOOST_CHECK_EQUAL(a.getType(), tlv::ContentType_Blob);
   BOOST_CHECK_EQUAL(a.getFreshnessPeriod(), 0_ms);
-  BOOST_CHECK(a.getFinalBlock() == nullopt);
+  BOOST_CHECK(a.getFinalBlock() == std::nullopt);
 
   MetaInfo b;
   BOOST_CHECK_NE(a.wireEncode(), b.wireEncode());
diff --git a/tests/unit/security/certificate-cache.t.cpp b/tests/unit/security/certificate-cache.t.cpp
index 8c715eb..51aa72b 100644
--- a/tests/unit/security/certificate-cache.t.cpp
+++ b/tests/unit/security/certificate-cache.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -43,7 +43,7 @@
   }
 
   void
-  checkFindByInterest(const Name& name, bool canBePrefix, optional<Certificate> expected) const
+  checkFindByInterest(const Name& name, bool canBePrefix, std::optional<Certificate> expected) const
   {
     Interest interest(name);
     interest.setCanBePrefix(canBePrefix);
@@ -95,10 +95,10 @@
   checkFindByInterest(cert.getIdentity(), true, cert);
   checkFindByInterest(cert.getKeyName(), true, cert);
   checkFindByInterest(cert.getName(), false, cert);
-  checkFindByInterest(Name(cert.getName()).appendVersion(), true, nullopt);
+  checkFindByInterest(Name(cert.getName()).appendVersion(), true, std::nullopt);
 
   advanceClocks(12_s);
-  checkFindByInterest(cert.getIdentity(), true, nullopt);
+  checkFindByInterest(cert.getIdentity(), true, std::nullopt);
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestCertificateCache
diff --git a/tests/unit/security/certificate.t.cpp b/tests/unit/security/certificate.t.cpp
index f113ca9..37243d6 100644
--- a/tests/unit/security/certificate.t.cpp
+++ b/tests/unit/security/certificate.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -366,7 +366,7 @@
   sigInfo.removeCustomTlv(tlv::AdditionalDescription);
   sigInfo.addCustomTlv(makeStringBlock(tlv::ValidityPeriod, "malformed"));
   sigInfo.setSignatureType(tlv::DigestSha256);
-  sigInfo.setKeyLocator(nullopt);
+  sigInfo.setKeyLocator(std::nullopt);
   Certificate cert6(cert3);
   cert6.setSignatureInfo(sigInfo);
   BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(cert6), expected6);
diff --git a/tests/unit/security/key-chain.t.cpp b/tests/unit/security/key-chain.t.cpp
index 98a0721..9bd97af 100644
--- a/tests/unit/security/key-chain.t.cpp
+++ b/tests/unit/security/key-chain.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -427,7 +427,7 @@
 
   const uint32_t expectedSigType = SignatureTypeTlvValue;
   const bool shouldHaveKeyLocator = true;
-  const optional<KeyLocator> expectedKeyLocator = cert.getName();
+  const std::optional<KeyLocator> expectedKeyLocator = cert.getName();
 
   bool
   verify(const SigningInfo&) const
@@ -504,7 +504,7 @@
 
   const uint32_t expectedSigType = SignatureTypeTlvValue;
   const bool shouldHaveKeyLocator = true;
-  const optional<KeyLocator> expectedKeyLocator = nullopt; // don't check KeyLocator value
+  const std::optional<KeyLocator> expectedKeyLocator = std::nullopt; // don't check KeyLocator value
 
   bool
   verify(const SigningInfo& si) const
@@ -524,12 +524,12 @@
 
   const uint32_t expectedSigType = tlv::DigestSha256;
   const bool shouldHaveKeyLocator = false;
-  const optional<KeyLocator> expectedKeyLocator = nullopt;
+  const std::optional<KeyLocator> expectedKeyLocator = std::nullopt;
 
   bool
   verify(const SigningInfo&) const
   {
-    return verifySignature(this->packet, nullopt);
+    return verifySignature(this->packet, std::nullopt);
   }
 };
 
@@ -591,7 +591,8 @@
   }
 
   void
-  checkKeyLocatorName(const Certificate& cert, const optional<Name>& klName = nullopt) const
+  checkKeyLocatorName(const Certificate& cert,
+                      const std::optional<Name>& klName = std::nullopt) const
   {
     auto kl = cert.getKeyLocator();
     if (!kl.has_value()) {
diff --git a/tests/unit/security/trust-anchor-container.t.cpp b/tests/unit/security/trust-anchor-container.t.cpp
index 19d6867..09825db 100644
--- a/tests/unit/security/trust-anchor-container.t.cpp
+++ b/tests/unit/security/trust-anchor-container.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -20,7 +20,6 @@
  */
 
 #include "ndn-cxx/security/trust-anchor-container.hpp"
-#include "ndn-cxx/util/io.hpp"
 
 #include "tests/boost-test.hpp"
 #include "tests/key-chain-fixture.hpp"
@@ -61,7 +60,7 @@
   }
 
   void
-  checkFindByInterest(const Name& name, bool canBePrefix, optional<Certificate> expected) const
+  checkFindByInterest(const Name& name, bool canBePrefix, std::optional<Certificate> expected) const
   {
     Interest interest(name);
     interest.setCanBePrefix(canBePrefix);
@@ -172,7 +171,7 @@
   checkFindByInterest(identity1.getName().getPrefix(-1), true, cert1);
   checkFindByInterest(cert1.getKeyName(), true, cert1);
   checkFindByInterest(cert1.getName(), false, cert1);
-  checkFindByInterest(Name(identity1.getName()).appendVersion(), true, nullopt);
+  checkFindByInterest(Name(identity1.getName()).appendVersion(), true, std::nullopt);
 
   auto makeIdentity1Cert = [=] (const std::string& issuerId) {
     auto key = identity1.getDefaultKey();
diff --git a/tests/unit/security/validation-policy-command-interest.t.cpp b/tests/unit/security/validation-policy-command-interest.t.cpp
index 604c60d..971b509 100644
--- a/tests/unit/security/validation-policy-command-interest.t.cpp
+++ b/tests/unit/security/validation-policy-command-interest.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -64,16 +64,16 @@
 {
 protected:
   Interest
-  makeCommandInterest(const Identity& identity, SignedInterestFormat format = SignedInterestFormat::V02)
+  makeCommandInterest(const Identity& id, SignedInterestFormat format = SignedInterestFormat::V02)
   {
-    Name name = identity.getName();
+    Name name = id.getName();
     name.append("CMD");
     switch (format) {
       case SignedInterestFormat::V02:
-        return m_signer.makeCommandInterest(name, signingByIdentity(identity));
+        return m_signer.makeCommandInterest(name, signingByIdentity(id));
       case SignedInterestFormat::V03: {
         Interest interest(name);
-        m_signer.makeSignedInterest(interest, signingByIdentity(identity));
+        m_signer.makeSignedInterest(interest, signingByIdentity(id));
         return interest;
       }
     }
@@ -198,7 +198,7 @@
 {
   auto i1 = makeCommandInterest(identity, SignedInterestFormat::V03);
   auto si = i1.getSignatureInfo().value();
-  si.setTime(nullopt);
+  si.setTime(std::nullopt);
   i1.setSignatureInfo(si);
   VALIDATE_FAILURE(i1, "Should fail (timestamp is missing)");
   BOOST_TEST(lastError.getCode() == ValidationError::POLICY_ERROR);
@@ -218,7 +218,7 @@
 {
   auto i1 = makeCommandInterest(identity, SignedInterestFormat::V03);
   auto si = i1.getSignatureInfo().value();
-  si.setKeyLocator(nullopt);
+  si.setKeyLocator(std::nullopt);
   i1.setSignatureInfo(si);
   VALIDATE_FAILURE(i1, "Should fail (missing KeyLocator)");
   BOOST_TEST(lastError.getCode() == ValidationError::INVALID_KEY_LOCATOR);
diff --git a/tests/unit/security/validator-fixture.hpp b/tests/unit/security/validator-fixture.hpp
index d8d357f..7e1e0b5 100644
--- a/tests/unit/security/validator-fixture.hpp
+++ b/tests/unit/security/validator-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -158,7 +158,7 @@
 
 private:
   void
-  verifyOriginalPacket(const optional<Certificate>&) override
+  verifyOriginalPacket(const std::optional<Certificate>&) override
   {
     // do nothing
   }
diff --git a/tests/unit/security/verification-helpers.t.cpp b/tests/unit/security/verification-helpers.t.cpp
index d3434c8..83d37da 100644
--- a/tests/unit/security/verification-helpers.t.cpp
+++ b/tests/unit/security/verification-helpers.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -632,21 +632,21 @@
   Interest interestOldFormat(dataset.goodInterestOldFormat);
   Interest badSigInterestOldFormat(dataset.badSigInterestOldFormat);
 
-  BOOST_CHECK(verifySignature(data, nullopt));
-  BOOST_CHECK(verifySignature(interest, nullopt));
-  BOOST_CHECK(verifySignature(interestOldFormat, nullopt));
+  BOOST_CHECK(verifySignature(data, std::nullopt));
+  BOOST_CHECK(verifySignature(interest, std::nullopt));
+  BOOST_CHECK(verifySignature(interestOldFormat, std::nullopt));
 
-  BOOST_CHECK(!verifySignature(badSigData, nullopt));
-  BOOST_CHECK(!verifySignature(badSigInterest, nullopt));
-  BOOST_CHECK(!verifySignature(badSigInterestOldFormat, nullopt));
+  BOOST_CHECK(!verifySignature(badSigData, std::nullopt));
+  BOOST_CHECK(!verifySignature(badSigInterest, std::nullopt));
+  BOOST_CHECK(!verifySignature(badSigInterestOldFormat, std::nullopt));
 
   Data unsignedData("/some/data");
   Interest unsignedInterest1("/some/interest/with/several/name/components");
   Interest unsignedInterest2("/interest-with-one-name-component");
 
-  BOOST_CHECK(!verifySignature(unsignedData, nullopt));
-  BOOST_CHECK(!verifySignature(unsignedInterest1, nullopt));
-  BOOST_CHECK(!verifySignature(unsignedInterest2, nullopt));
+  BOOST_CHECK(!verifySignature(unsignedData, std::nullopt));
+  BOOST_CHECK(!verifySignature(unsignedInterest1, std::nullopt));
+  BOOST_CHECK(!verifySignature(unsignedInterest2, std::nullopt));
 }
 
 const uint8_t sha256DataUnrecognizedElements[] = {
@@ -673,8 +673,8 @@
   Data data(Block{sha256DataUnrecognizedElements});
   Interest interest(Block{sha256InterestUnrecognizedElements});
 
-  BOOST_CHECK(verifySignature(data, nullopt));
-  BOOST_CHECK(verifySignature(interest, nullopt));
+  BOOST_CHECK(verifySignature(data, std::nullopt));
+  BOOST_CHECK(verifySignature(interest, std::nullopt));
 }
 
 BOOST_AUTO_TEST_SUITE_END() // TestVerificationHelpers
diff --git a/tests/unit/signature-info.t.cpp b/tests/unit/signature-info.t.cpp
index dff4241..1257851 100644
--- a/tests/unit/signature-info.t.cpp
+++ b/tests/unit/signature-info.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -100,7 +100,7 @@
 
   info.wireEncode();
   BOOST_CHECK_EQUAL(info.hasWire(), true);
-  info.setKeyLocator(nullopt);
+  info.setKeyLocator(std::nullopt);
   BOOST_CHECK_EQUAL(info.hasKeyLocator(), false);
   BOOST_CHECK_THROW(info.getKeyLocator(), SignatureInfo::Error);
   BOOST_CHECK_EQUAL(info.hasWire(), false);
@@ -127,7 +127,7 @@
 
   info.wireEncode();
   BOOST_CHECK_EQUAL(info.hasWire(), true);
-  info.setNonce(nullopt);
+  info.setNonce(std::nullopt);
   BOOST_CHECK_EQUAL(info.hasWire(), false);
   BOOST_CHECK(!info.getNonce());
 }
@@ -152,7 +152,7 @@
 
   info.wireEncode();
   BOOST_CHECK_EQUAL(info.hasWire(), true);
-  info.setTime(nullopt);
+  info.setTime(std::nullopt);
   BOOST_CHECK_EQUAL(info.hasWire(), false);
   BOOST_CHECK(!info.getTime());
 }
@@ -176,7 +176,7 @@
 
   info.wireEncode();
   BOOST_CHECK_EQUAL(info.hasWire(), true);
-  info.setSeqNum(nullopt);
+  info.setSeqNum(std::nullopt);
   BOOST_CHECK_EQUAL(info.hasWire(), false);
   BOOST_CHECK(!info.getSeqNum());
 }
@@ -452,7 +452,7 @@
 
   info2.wireEncode();
   BOOST_CHECK_EQUAL(info2.hasWire(), true);
-  info2.setValidityPeriod(nullopt);
+  info2.setValidityPeriod(std::nullopt);
   BOOST_CHECK_THROW(info2.getValidityPeriod(), SignatureInfo::Error);
   BOOST_CHECK_EQUAL(info2.hasWire(), false);
 }