Fixed OS X build

This commit is contained in:
Daniel Wolf 2016-06-16 09:36:33 +02:00 committed by Daniel Wolf
parent 6c9612d2c3
commit b2f702c8f4
6 changed files with 16 additions and 12 deletions

View File

@ -4,11 +4,11 @@
template<typename T> template<typename T>
class BoundedTimeline : public Timeline<T> { class BoundedTimeline : public Timeline<T> {
using Timeline<T>::time_type; using typename Timeline<T>::time_type;
using Timeline<T>::equals; using Timeline<T>::equals;
public: public:
using Timeline<T>::iterator; using typename Timeline<T>::iterator;
using Timeline<T>::end; using Timeline<T>::end;
explicit BoundedTimeline(TimeRange range) : explicit BoundedTimeline(TimeRange range) :

View File

@ -7,7 +7,7 @@ class ContinuousTimeline : public BoundedTimeline<T> {
public: public:
ContinuousTimeline(TimeRange range, T defaultValue) : ContinuousTimeline(TimeRange range, T defaultValue) :
BoundedTimeline(range), BoundedTimeline<T>(range),
defaultValue(defaultValue) defaultValue(defaultValue)
{ {
// Virtual function call in constructor. Derived constructors shouldn't call this one! // Virtual function call in constructor. Derived constructors shouldn't call this one!
@ -28,10 +28,10 @@ public:
ContinuousTimeline(range, defaultValue, initializerList.begin(), initializerList.end()) ContinuousTimeline(range, defaultValue, initializerList.begin(), initializerList.end())
{} {}
using BoundedTimeline<T>::clear; using BoundedTimeline<T>::clear;
void clear(const TimeRange& range) override { void clear(const TimeRange& range) override {
set(Timed<T>(range, defaultValue)); BoundedTimeline<T>::set(Timed<T>(range, defaultValue));
} }
private: private:

View File

@ -1,4 +1,3 @@
#include <boost/bimap.hpp>
#include "Phone.h" #include "Phone.h"
using std::string; using std::string;

View File

@ -5,15 +5,16 @@ template<typename TCollection>
std::vector<std::pair<typename TCollection::value_type, typename TCollection::value_type>> getPairs(const TCollection& collection) { std::vector<std::pair<typename TCollection::value_type, typename TCollection::value_type>> getPairs(const TCollection& collection) {
using TElement = typename TCollection::value_type; using TElement = typename TCollection::value_type;
using TPair = std::pair<TElement, TElement>; using TPair = std::pair<TElement, TElement>;
using TIterator = typename TCollection::const_iterator;
auto begin = collection.begin(); auto begin = collection.begin();
auto end = collection.end(); auto end = collection.end();
if (begin == end || ++TCollection::const_iterator(begin) == end) { if (begin == end || ++TIterator(begin) == end) {
return std::vector<TPair>(); return std::vector<TPair>();
} }
std::vector<TPair> result; std::vector<TPair> 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)); result.push_back(TPair(*first, *second));
} }
return result; return result;

View File

@ -109,10 +109,13 @@ string toASCII(const u32string& s) {
} }
u32string utf8ToUtf32(const string& s) { u32string utf8ToUtf32(const string& s) {
// Visual Studio 2015 has a bug regarding char32_t: #if defined(_MSC_VER) && _MSC_VER <= 1900
// https://connect.microsoft.com/VisualStudio/feedback/details/1403302/unresolved-external-when-using-codecvt-utf8 // Workaround for Visual Studio 2015
// Once VS2016 is out, we can use char32_t instead of uint32_t as type arguments and get rid of the outer conversion. // See https://connect.microsoft.com/VisualStudio/feedback/details/1403302/unresolved-external-when-using-codecvt-utf8
std::wstring_convert<std::codecvt_utf8<uint32_t>, uint32_t> convert; std::wstring_convert<std::codecvt_utf8<uint32_t>, uint32_t> convert;
return u32string(reinterpret_cast<const char32_t*>(convert.from_bytes(s).c_str())); return u32string(reinterpret_cast<const char32_t*>(convert.from_bytes(s).c_str()));
#else
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> convert;
return convert.from_bytes(s);
#endif
} }

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <vector> #include <vector>
#include <string>
std::vector<std::string> tokenizeText(const std::u32string& text); std::vector<std::string> tokenizeText(const std::u32string& text);