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
This commit is contained in:
Lars Gullik Bjønnes 2001-04-17 14:22:53 +00:00
parent 53cf203fb9
commit 998cee223a
4 changed files with 36 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2001-04-17 Lars Gullik Bjønnes <larsbj@birdstep.com>
* 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 <rae@lyx.org>
* tempname.C (make_tempfile): #warning triggers an error on Sun CC 6.0

View File

@ -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();

View File

@ -3,7 +3,10 @@
#ifndef LYX_ALGO_H
#define LYX_ALGO_H
//namespace lyx {
#include <utility>
namespace lyx {
/// Returns true if the sequence first,last is sorted, false if not.
template <class For>
@ -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 <class For, class Cmp>
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 <class P1, class P2>
P1 operator()(std::pair<P1, P2> const & p) {
return p.first;
}
};
template <class InputIter, class OutputIter, class Func>
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

View File

@ -12,7 +12,7 @@
#endif
///
class Path : public boost::noncopyable {
class Path : boost::noncopyable {
public:
///
explicit