Add operator<< for TopicPartition

This commit is contained in:
Matias Fontanini
2016-06-15 07:44:28 -07:00
parent 6877c4be03
commit 9e79321a1f
5 changed files with 49 additions and 0 deletions

View File

@@ -27,10 +27,12 @@
*
*/
#include <iostream>
#include <librdkafka/rdkafka.h>
#include "topic_partition.h"
using std::string;
using std::ostream;
namespace cppkafka {
@@ -71,4 +73,8 @@ int64_t TopicPartition::get_offset() const {
return offset_;
}
ostream& operator<<(ostream& output, const TopicPartition& rhs) {
return output << rhs.get_topic() << "[" << rhs.get_partition() << "]";
}
} // cppkafka