3 * \file lyxfunctional.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
11 * \brief Convenient function objects for use with LyX
13 * This is currently a small collection of small function objects for use
14 * together with std::algorithms.
18 #ifndef LYX_FUNCTIONAL_H
19 #define LYX_FUNCTIONAL_H
25 // Functors used in the template.
29 class equal_1st_in_pair {
32 typedef typename T::first_type first_type;
36 equal_1st_in_pair(first_type const & value) : value_(value) {}
38 bool operator() (pair_type const & p) const {
39 return p.first == value_;
43 first_type const & value_;
49 class equal_2nd_in_pair {
52 typedef typename T::second_type second_type;
56 equal_2nd_in_pair(second_type const & value) : value_(value) {}
58 bool operator() (pair_type const & p) const {
59 return p.second == value_;
63 second_type const & value_;
66 } // end of namespace lyx