From: Lars Gullik Bjønnes Date: Tue, 17 Apr 2001 14:22:53 +0000 (+0000) Subject: inherit privately from noncopyable, add algos, use namespace lyx X-Git-Tag: 1.6.10~21300 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=998cee223a0784c8ba6f01a89f758fc474a3b5fd;p=features.git inherit privately from noncopyable, add algos, use namespace lyx git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1933 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/support/ChangeLog b/src/support/ChangeLog index 500846e5e1..7c8c5dacca 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,10 @@ +2001-04-17 Lars Gullik Bjønnes + + * lyxalgo.h: put into namespace lyx, add firster and copy_if + + * FileInfo.h: inherit privately from noncopyable + * path.h: ditto + 2001-04-16 Allan Rae * tempname.C (make_tempfile): #warning triggers an error on Sun CC 6.0 diff --git a/src/support/FileInfo.h b/src/support/FileInfo.h index 41063a9ba5..8f965731ce 100644 --- a/src/support/FileInfo.h +++ b/src/support/FileInfo.h @@ -26,7 +26,7 @@ /** Use objects of this class to get information about files. */ -class FileInfo : public boost::noncopyable { +class FileInfo : boost::noncopyable { public: /// FileInfo(); diff --git a/src/support/lyxalgo.h b/src/support/lyxalgo.h index deaf953188..2d8d49f06c 100644 --- a/src/support/lyxalgo.h +++ b/src/support/lyxalgo.h @@ -3,7 +3,10 @@ #ifndef LYX_ALGO_H #define LYX_ALGO_H -//namespace lyx { +#include + +namespace lyx { + /// Returns true if the sequence first,last is sorted, false if not. template @@ -17,6 +20,7 @@ bool sorted(For first, For last) return true; } + /// Cmp is the same Cmp as you would pass to std::sort. template bool sorted(For first, For last, Cmp cmp) @@ -29,5 +33,26 @@ bool sorted(For first, For last, Cmp cmp) return true; } -// } // end of namespace lyx + +struct firster { + template + P1 operator()(std::pair const & p) { + return p.first; + } +}; + + +template +OutputIter copy_if(InputIter first, InputIter last, + OutputIter result, Func func) +{ + for (; first != last; ++first) { + if (func(*first)) { + *result++ = *first; + } + } + return result; +} + +} // end of namespace lyx #endif diff --git a/src/support/path.h b/src/support/path.h index 2ff6f05f8d..6081881062 100644 --- a/src/support/path.h +++ b/src/support/path.h @@ -12,7 +12,7 @@ #endif /// -class Path : public boost::noncopyable { +class Path : boost::noncopyable { public: /// explicit