From 8804330d8345d701997845432eb5b32f33c296f9 Mon Sep 17 00:00:00 2001 From: Kerrick Staley Date: Mon, 1 Feb 2016 12:32:28 -0800 Subject: [PATCH] Add operator<< to OSRM_STRONG_TYPEDEF Useful for debugging. --- include/util/strong_typedef.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/util/strong_typedef.hpp b/include/util/strong_typedef.hpp index 58e70602f..8aa49b515 100644 --- a/include/util/strong_typedef.hpp +++ b/include/util/strong_typedef.hpp @@ -1,6 +1,7 @@ #ifndef STRONG_TYPEDEF_HPP #define STRONG_TYPEDEF_HPP +#include #include #include @@ -17,6 +18,7 @@ namespace osrm { \ static_assert(std::is_arithmetic(), ""); \ From x; \ + friend std::ostream& operator<<(std::ostream& stream, const To& inst); \ \ public: \ To() = default; \ @@ -40,6 +42,9 @@ namespace osrm return std::hash()(static_cast(k)); \ } \ }; \ + } \ + inline std::ostream& operator<<(std::ostream& stream, const To& inst) { \ + return stream << #To << '(' << inst.x << ')'; \ } }