diff --git a/view.cpp b/view.cpp index 82464485..32d84bed 100644 --- a/view.cpp +++ b/view.cpp @@ -11,37 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * Copyright 2016-2017 Danny Robson + * Copyright 2017 Danny Robson */ #include "view.hpp" - -#include -#include - - -/////////////////////////////////////////////////////////////////////////////// -namespace util { -#define OSTREAM(A) \ - template <> \ - std::ostream& \ - operator<< (std::ostream &os, view a) { \ - std::copy (a.cbegin (), \ - std::find (a.cbegin (), a.cend (), '\0'), \ - std::ostream_iterator (os)); \ - \ - return os; \ - } - - OSTREAM(const char*) - OSTREAM(char*) - OSTREAM( signed char*) - OSTREAM(unsigned char*) - OSTREAM(const signed char*) - OSTREAM(const unsigned char*) - OSTREAM(std::string::const_iterator) - OSTREAM(std::string::iterator) - -#undef OSTREAM -} - diff --git a/view.hpp b/view.hpp index db47cd56..c21c7e92 100644 --- a/view.hpp +++ b/view.hpp @@ -27,6 +27,7 @@ #include #include #include +#include namespace util { template @@ -356,6 +357,21 @@ namespace util { } + /////////////////////////////////////////////////////////////////////////// + template + std::ostream& + operator<< (std::ostream &os, view val) + { + std::copy ( + std::cbegin (val), + std::cend (val), + std::ostream_iterator (os) + ); + + return os; + } + + /////////////////////////////////////////////////////////////////////////// /// a basic stringlike comparison operator that behaves as /// std::string::compare would. @@ -378,10 +394,6 @@ namespace util { } - /////////////////////////////////////////////////////////////////////////// - template - std::ostream& - operator<< (std::ostream&, view); }