From b2f702c8f47870064bac1c1915c54e58de1ea1b9 Mon Sep 17 00:00:00 2001 From: Daniel Wolf Date: Thu, 16 Jun 2016 09:36:33 +0200 Subject: [PATCH] Fixed OS X build --- src/BoundedTimeline.h | 4 ++-- src/ContinuousTimeline.h | 6 +++--- src/Phone.cpp | 1 - src/pairs.h | 5 +++-- src/stringTools.cpp | 11 +++++++---- src/tokenization.h | 1 + 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/BoundedTimeline.h b/src/BoundedTimeline.h index 891dfe3..6e732c7 100644 --- a/src/BoundedTimeline.h +++ b/src/BoundedTimeline.h @@ -4,11 +4,11 @@ template class BoundedTimeline : public Timeline { - using Timeline::time_type; + using typename Timeline::time_type; using Timeline::equals; public: - using Timeline::iterator; + using typename Timeline::iterator; using Timeline::end; explicit BoundedTimeline(TimeRange range) : diff --git a/src/ContinuousTimeline.h b/src/ContinuousTimeline.h index 59bc477..3346540 100644 --- a/src/ContinuousTimeline.h +++ b/src/ContinuousTimeline.h @@ -7,7 +7,7 @@ class ContinuousTimeline : public BoundedTimeline { public: ContinuousTimeline(TimeRange range, T defaultValue) : - BoundedTimeline(range), + BoundedTimeline(range), defaultValue(defaultValue) { // Virtual function call in constructor. Derived constructors shouldn't call this one! @@ -28,10 +28,10 @@ public: ContinuousTimeline(range, defaultValue, initializerList.begin(), initializerList.end()) {} - using BoundedTimeline::clear; + using BoundedTimeline::clear; void clear(const TimeRange& range) override { - set(Timed(range, defaultValue)); + BoundedTimeline::set(Timed(range, defaultValue)); } private: diff --git a/src/Phone.cpp b/src/Phone.cpp index a2cf98e..6d0c5a3 100644 --- a/src/Phone.cpp +++ b/src/Phone.cpp @@ -1,4 +1,3 @@ -#include #include "Phone.h" using std::string; diff --git a/src/pairs.h b/src/pairs.h index 75fe587..8fe45bf 100644 --- a/src/pairs.h +++ b/src/pairs.h @@ -5,15 +5,16 @@ template std::vector> getPairs(const TCollection& collection) { using TElement = typename TCollection::value_type; using TPair = std::pair; + using TIterator = typename TCollection::const_iterator; auto begin = collection.begin(); auto end = collection.end(); - if (begin == end || ++TCollection::const_iterator(begin) == end) { + if (begin == end || ++TIterator(begin) == end) { return std::vector(); } std::vector result; - for (auto first = begin, second = ++TCollection::const_iterator(begin); second != end; ++first, ++second) { + for (auto first = begin, second = ++TIterator(begin); second != end; ++first, ++second) { result.push_back(TPair(*first, *second)); } return result; diff --git a/src/stringTools.cpp b/src/stringTools.cpp index ca2f91c..ad4fec7 100644 --- a/src/stringTools.cpp +++ b/src/stringTools.cpp @@ -109,10 +109,13 @@ string toASCII(const u32string& s) { } u32string utf8ToUtf32(const string& s) { - // Visual Studio 2015 has a bug regarding char32_t: - // https://connect.microsoft.com/VisualStudio/feedback/details/1403302/unresolved-external-when-using-codecvt-utf8 - // Once VS2016 is out, we can use char32_t instead of uint32_t as type arguments and get rid of the outer conversion. - +#if defined(_MSC_VER) && _MSC_VER <= 1900 + // Workaround for Visual Studio 2015 + // See https://connect.microsoft.com/VisualStudio/feedback/details/1403302/unresolved-external-when-using-codecvt-utf8 std::wstring_convert, uint32_t> convert; return u32string(reinterpret_cast(convert.from_bytes(s).c_str())); +#else + std::wstring_convert, char32_t> convert; + return convert.from_bytes(s); +#endif } diff --git a/src/tokenization.h b/src/tokenization.h index 55fcfb9..36fe276 100644 --- a/src/tokenization.h +++ b/src/tokenization.h @@ -1,5 +1,6 @@ #pragma once #include +#include std::vector tokenizeText(const std::u32string& text); \ No newline at end of file