[Debtags-commits] [svn] r1715 - in tagcoll/2.0: . tagcoll
Enrico Zini
enrico at costa.debian.org
Tue May 9 00:11:03 UTC 2006
Author: enrico
Date: Tue May 9 00:11:02 2006
New Revision: 1715
Added:
tagcoll/2.0/tagcoll/sink.cc
Modified:
tagcoll/2.0/ (props changed)
tagcoll/2.0/tagcoll/sink.h
Log:
r2602 at viaza: enrico | 2006-05-07 11:49:41 -0500
Added countingSink
Modified: tagcoll/2.0/tagcoll/sink.h
==============================================================================
--- tagcoll/2.0/tagcoll/sink.h (original)
+++ tagcoll/2.0/tagcoll/sink.h Tue May 9 00:11:02 2006
@@ -24,6 +24,7 @@
*/
#include <wibble/mixin.h>
+#include <utility>
namespace tagcoll
{
@@ -38,7 +39,7 @@
Sink& operator=(const Data&) const { return *this; }
};
-Sink sink()
+inline Sink sink()
{
return Sink();
}
@@ -47,11 +48,12 @@
/**
* Consumer that discards its input
*/
-class CountingSink : public wibble::mixin::OutputIterator<CountingSink>
+template<typename COUNTER>
+class CountingSink : public wibble::mixin::OutputIterator< CountingSink<COUNTER> >
{
- int& count;
+ COUNTER& count;
public:
- ContingSink(int& count) : count(count) {}
+ CountingSink(COUNTER& count) : count(count) {}
// TODO: see if there's a way of implementing the count using size() when
// the method actually exists
@@ -65,9 +67,10 @@
}
};
-CountingSink countingSink(int& count)
+template<typename COUNTER>
+inline CountingSink<COUNTER> countingSink(COUNTER& count)
{
- return CountingSink(count);
+ return CountingSink<COUNTER>(count);
}
More information about the Debtags-commits
mailing list