NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
asserts.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_CORE_ASSERTS_HPP
27 #define NFD_CORE_ASSERTS_HPP
28 
29 #include "common.hpp"
30 #include <boost/concept/assert.hpp>
31 #include <boost/concept_check.hpp>
32 #include <type_traits>
33 
34 namespace nfd {
35 namespace detail {
36 
37 // As of Boost 1.54.0, the internal implementation of BOOST_CONCEPT_ASSERT does not allow
38 // multiple assertions on the same line, so we have to combine multiple concepts together.
39 
40 template<typename T>
41 class StlForwardIteratorConcept : public boost::ForwardIterator<T>
42  , public boost::DefaultConstructible<T>
43 {
44 };
45 
46 } // namespace detail
47 } // namespace nfd
48 
52 #define NFD_ASSERT_DEFAULT_CONSTRUCTIBLE(T) \
53  static_assert(std::is_default_constructible<T>::value, \
54  #T " must be default-constructible"); \
55  BOOST_CONCEPT_ASSERT((boost::DefaultConstructible<T>))
56 
62 #define NFD_ASSERT_FORWARD_ITERATOR(T) \
63  BOOST_CONCEPT_ASSERT((::nfd::detail::StlForwardIteratorConcept<T>)); \
64  static_assert(std::is_default_constructible<T>::value, \
65  #T " must be default-constructible")
66 
67 #endif // NFD_CORE_ASSERTS_HPP
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40