2004-11-06 Lars Gullik Bjonnes <larsbj@gullik.net>
+ * RadioButtonGroup.C (set): use bind, equal_to instead of
+ equal_2nd_in_pair
+
* xformsImage.C (loadableFormats): use bind, equal_to instead of
compare_memfun
#include "debug.h"
-#include "support/lyxfunctional.h"
-
#include "lyx_forms.h"
#include <boost/assert.hpp>
+#include <boost/bind.hpp>
+
+using boost::bind;
using std::endl;
+using std::equal_to;
namespace lyx {
namespace frontend {
{
ButtonValueMap::const_iterator it =
find_if(map.begin(), map.end(),
- lyx::equal_2nd_in_pair<ButtonValuePair>(value));
+ bind(equal_to<size_type>(),
+ bind(&ButtonValuePair::second, _1),
+ value));
if (it != map.end()) {
fl_set_button(it->first, 1);
2004-11-06 Lars Gullik Bjonnes <larsbj@gullik.net>
+ * translator.h: use bind, equal_to instead of equal_1st_in_pair
+ and equal_2nd_in_pair
+
+ * Makefile.am (libsupport_la_SOURCES): remove lyxfunctional.h
+ * lyxfunctional.h: delete file
+
* lyxfunctional.h: delete compare_memfun and helper classes
* forkedcontr.C (find_pid): use bind, equal_to instead of
- compare_memfun
+ compare_memfun
* lyxfunctional.h: delete back_inserter_fun functions and helper
classes.
lstrings.C \
lstrings.h \
lyxalgo.h \
- lyxfunctional.h \
lyxlib.h \
lyxmanip.h \
lyxtime.C \
+++ /dev/null
-// -*- C++ -*-
-/**
- * \file lyxfunctional.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- *
- * Full author contact details are available in file CREDITS.
- *
- * \brief Convenient function objects for use with LyX
- *
- * This is currently a small collection of small function objects for use
- * together with std::algorithms.
- */
-
-
-#ifndef LYX_FUNCTIONAL_H
-#define LYX_FUNCTIONAL_H
-
-#include <iterator>
-
-namespace lyx {
-
-// Functors used in the template.
-
-///
-template<typename T>
-class equal_1st_in_pair {
-public:
- ///
- typedef typename T::first_type first_type;
- ///
- typedef T pair_type;
- ///
- equal_1st_in_pair(first_type const & value) : value_(value) {}
- ///
- bool operator() (pair_type const & p) const {
- return p.first == value_;
- }
-private:
- ///
- first_type const & value_;
-};
-
-
-///
-template<typename T>
-class equal_2nd_in_pair {
-public:
- ///
- typedef typename T::second_type second_type;
- ///
- typedef T pair_type;
- ///
- equal_2nd_in_pair(second_type const & value) : value_(value) {}
- ///
- bool operator() (pair_type const & p) const {
- return p.second == value_;
- }
-private:
- ///
- second_type const & value_;
-};
-
-} // end of namespace lyx
-#endif
#define TRANSLATOR_H
#include <boost/assert.hpp>
+#include <boost/bind.hpp>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
-#include "support/lyxfunctional.h"
/**
* This class template is used to translate between two elements, specifically
* it was worked out to translate between an enum and strings when reading
// For explanation see the next find() function.
typename Map::const_iterator it =
std::find_if(map.begin(), map.end(),
- lyx::equal_1st_in_pair<MapPair>(first)
+ boost::bind(std::equal_to<T1>(),
+ boost::bind(&MapPair::first, _1),
+ first)
);
if (it != map.end()) {
// equal_to(select2nd(pair) , second)
typename Map::const_iterator it =
std::find_if(map.begin(), map.end(),
- lyx::equal_2nd_in_pair<MapPair>(second)
+ boost::bind(std::equal_to<T2>(),
+ boost::bind(&MapPair::second, _1),
+ second)
);
if (it != map.end())