From 19fef8ddab9158f4ffe095ffdb1408af30cabf23 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Thu, 31 Oct 2013 15:55:34 +0400 Subject: [PATCH] Fixed MSVC related bugs --- boost/type_index/template_info.hpp | 4 +++- boost/type_index/type_info.hpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/boost/type_index/template_info.hpp b/boost/type_index/template_info.hpp index 6c8a75b..15c6e86 100644 --- a/boost/type_index/template_info.hpp +++ b/boost/type_index/template_info.hpp @@ -232,7 +232,9 @@ public: /// Returns user-friendly name std::string name_demangled() const { - return std::string(name_, std::strlen(name_ + detail::ctti_skip_size_at_end)); + std::size_t len = std::strlen(name_ + detail::ctti_skip_size_at_end); + while (name_[len - 1] == ' ') --len; // MSVC sometimes adds whitespaces + return std::string(name_, len); } bool operator == (const template_info& rhs) const BOOST_NOEXCEPT { diff --git a/boost/type_index/type_info.hpp b/boost/type_index/type_info.hpp index 898d5bc..895faac 100644 --- a/boost/type_index/type_info.hpp +++ b/boost/type_index/type_info.hpp @@ -175,7 +175,7 @@ public: } std::string::size_type end = ret.rfind(">"); BOOST_ASSERT(end != std::string::npos); - while (ret[end] == ' ') { + while (ret[end - 1] == ' ') { -- end; }