#include "stringpiece.h" namespace cxxmph { template struct iterator_first : public iterator { iterator_first(iterator it) : iterator(it) { } const typename iterator::value_type::first_type& operator*() const { return this->iterator::operator*().first; } }; template iterator_first make_iterator_first(iterator it) { return iterator_first(it); } template class MakeStringPiece { public: StringPiece operator()(const value& v) { return StringPiece(reinterpret_cast(&v), sizeof(value)); } }; template <> class MakeStringPiece { public: StringPiece operator()(const std::string& v) { return StringPiece(v); } }; template <> class MakeStringPiece { public: StringPiece operator()(const char* v) { return StringPiece(v); } }; template struct iterator_stringpiece : public iterator { iterator_stringpiece(iterator it) : iterator(it) { } StringPiece operator*() const { return MakeStringPiece()(this->iterator::operator*()); } }; template iterator_stringpiece make_iterator_stringpiece(iterator it) { return iterator_stringpiece(it); } } // namespace cxxmph