diff --git a/Import/Vlpp.h b/Import/Vlpp.h index 60b8f85d..631e7734 100644 --- a/Import/Vlpp.h +++ b/Import/Vlpp.h @@ -367,6 +367,10 @@ namespace vl }; } + // G++ workaround + template + struct PairGet; + /// A type representing a pair of key and value. /// Type of the key. /// Type of the value. @@ -427,25 +431,32 @@ namespace vl return key == p.key && value == p.value; } - ///////////////////////////////////////////////////////////////////// + template + decltype(auto) get() + { + return PairGet::get(*this); + } template - typename pair_internal::TypePairElementRetriver>::Type& get() = delete; + decltype(auto) get() const + { + return PairGet::get(*this); + } + }; - template<> - typename pair_internal::TypePairElementRetriver<0, Pair>::Type& get<0>() { return key; } + template + struct PairGet + { + static typename pair_internal::TypePairElementRetriver<0, Pair>::Type& get(Pair& p) { return p.key; } + static typename pair_internal::TypePairElementRetriver<0, const Pair>::Type& get(const Pair& p) { return p.key; } + }; - template<> - typename pair_internal::TypePairElementRetriver<1, Pair>::Type& get<1>() { return value; } - template - typename pair_internal::TypePairElementRetriver>::Type& get() const = delete; - - template<> - typename pair_internal::TypePairElementRetriver<0, const Pair>::Type& get<0>() const { return key; } - - template<> - typename pair_internal::TypePairElementRetriver<1, const Pair>::Type& get<1>() const { return value; } + template + struct PairGet + { + static typename pair_internal::TypePairElementRetriver<1, Pair>::Type& get(Pair& p) { return p.value; } + static typename pair_internal::TypePairElementRetriver<1, const Pair>::Type& get(const Pair& p) { return p.value; } }; template diff --git a/Import/VlppOS.Linux.cpp b/Import/VlppOS.Linux.cpp index ab3da025..9f9c257c 100644 --- a/Import/VlppOS.Linux.cpp +++ b/Import/VlppOS.Linux.cpp @@ -44,7 +44,7 @@ FilePath } if (fullPath.Length() == 0) - fullPath = L"/"; + fullPath = WString::Unmanaged(L"/"); if (fullPath[0] != Delimiter) { diff --git a/Import/VlppOS.cpp b/Import/VlppOS.cpp index f5af9494..faea87a9 100644 --- a/Import/VlppOS.cpp +++ b/Import/VlppOS.cpp @@ -45,6 +45,11 @@ FilePath } } + FilePath::FilePath() + { + Initialize(); + } + FilePath::FilePath(const WString& _filePath) :fullPath(_filePath) { diff --git a/Import/VlppOS.h b/Import/VlppOS.h index 62069695..e669509f 100644 --- a/Import/VlppOS.h +++ b/Import/VlppOS.h @@ -1907,7 +1907,7 @@ namespace vl /// Create a root path. /// returns different values for root path on different platforms. Do not rely on the value. - FilePath() = default; + FilePath(); /// Create a file path. /// Content of the file path. If it is a relative path, it will be converted to an absolute path. FilePath(const WString& _filePath);