NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
algorithm.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_CORE_ALGORITHM_HPP
27 #define NFD_CORE_ALGORITHM_HPP
28 
29 #include "common.hpp"
30 #include <boost/concept/requires.hpp>
31 
32 namespace nfd {
33 
43 template<typename It, typename Pred>
44 BOOST_CONCEPT_REQUIRES(
45  ((boost::BidirectionalIterator<It>))
46  ((boost::UnaryPredicate<Pred, typename std::iterator_traits<It>::value_type>)),
47  (It)
48 )
49 find_last_if(It first, It last, Pred p)
50 {
51  std::reverse_iterator<It> firstR(first), lastR(last);
52  auto found = std::find_if(lastR, firstR, p);
53  return found == firstR ? last : std::prev(found.base());
54 }
55 
56 } // namespace nfd
57 
58 #endif // NFD_CORE_ALGORITHM_HPP
It find_last_if(It first, It last, Pred p)
Definition: algorithm.hpp:49
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40