]> git.lyx.org Git - features.git/commitdiff
inherit privately from noncopyable, add algos, use namespace lyx
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 17 Apr 2001 14:22:53 +0000 (14:22 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 17 Apr 2001 14:22:53 +0000 (14:22 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1933 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/ChangeLog
src/support/FileInfo.h
src/support/lyxalgo.h
src/support/path.h

index 500846e5e1d6e9f5fc9fa89d5c3fcef25735318d..7c8c5dacca37a2317be844b5360bc5956afbd045 100644 (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
index 41063a9ba5b740c182027375b95fb002d8a83b9e..8f965731ceb43c6945fb4c48440309b63011967e 100644 (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();
index deaf9531884eb3596b79f3fc81a8b8be4d7b15d0..2d8d49f06c943b3bf615987e90238e8a987803e2 100644 (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
index 2ff6f05f8d84430a7a42ea0fc3140ff045e72595..6081881062c7464f38861e3e88a2358cd976ac2c 100644 (file)
@@ -12,7 +12,7 @@
 #endif
 
 ///
-class Path : public boost::noncopyable {
+class Path : boost::noncopyable {
 public:
        ///
        explicit