diff options
Diffstat (limited to 'src/ypipe.hpp')
-rw-r--r-- | src/ypipe.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ypipe.hpp b/src/ypipe.hpp index 2a2d725..26f021c 100644 --- a/src/ypipe.hpp +++ b/src/ypipe.hpp @@ -162,6 +162,17 @@ namespace zmq return true; } + // Applies the function fn to the first elemenent in the pipe + // and returns the value returned by the fn. + // The pipe mustn't be empty or the function crashes. + inline bool probe (bool (*fn)(T &)) + { + bool rc = check_read (); + zmq_assert (rc); + + return (*fn) (queue.front ()); + } + protected: // Allocation-efficient queue to store pipe items. |