Fix build with Visual Studio
First, VS2015 doesn't appear to support importing alias templates directly, so let's make an alias template ourselves and import every alias we need. That approach doesn't work with VS2013, apparently due to lack of support for expression SFINAE. Thus, we now use our custom alias templates on VS2013. Also, I moved type_trait_aliases.hpp to the wesnothlib project where it belongs. Note that because of requiring expression SFINAE on VS2015, building Wesnoth on VS2015 now requires that Update 1 or above is installed.
This commit is contained in:
parent
238c175045
commit
fb8506dbac
5 changed files with 25 additions and 14 deletions
|
@ -4000,7 +4000,6 @@
|
|||
<ClInclude Include="..\..\src\utils\reference_counter.hpp" />
|
||||
<ClInclude Include="..\..\src\utils\sha1.hpp" />
|
||||
<ClInclude Include="..\..\src\utils\smart_list.hpp" />
|
||||
<ClInclude Include="..\..\src\utils\type_trait_aliases.hpp" />
|
||||
<ClInclude Include="..\..\src\variable.hpp" />
|
||||
<ClInclude Include="..\..\src\variable_info.hpp" />
|
||||
<ClInclude Include="..\..\src\variable_info_detail.hpp" />
|
||||
|
|
|
@ -2483,9 +2483,6 @@
|
|||
<ClInclude Include="..\..\src\utils\smart_list.hpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\utils\type_trait_aliases.hpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\serialization\tag.hpp">
|
||||
<Filter>serialization</Filter>
|
||||
</ClInclude>
|
||||
|
|
|
@ -190,6 +190,7 @@
|
|||
<ClInclude Include="..\..\src\spirit_po\po_message_adapted.hpp" />
|
||||
<ClInclude Include="..\..\src\spirit_po\version.hpp" />
|
||||
<ClInclude Include="..\..\src\tstring.hpp" />
|
||||
<ClInclude Include="..\..\src\utils\type_trait_aliases.hpp" />
|
||||
<ClInclude Include="..\..\src\version.hpp" />
|
||||
<ClInclude Include="..\..\src\wesconfig.h" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
<Filter Include="spirit_po">
|
||||
<UniqueIdentifier>{36afc638-474c-4646-b7ac-c1d8df8344f2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Utils">
|
||||
<UniqueIdentifier>{dd5bcb3f-5af9-4dce-bcf3-9c23cec65372}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\serialization\binary_or_text.cpp">
|
||||
|
@ -128,5 +131,8 @@
|
|||
<Filter>spirit_po</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\spirit_po.hpp" />
|
||||
<ClInclude Include="..\..\src\utils\type_trait_aliases.hpp">
|
||||
<Filter>Utils</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -21,19 +21,27 @@ namespace utils
|
|||
{
|
||||
//
|
||||
// These aliases are part of the standard starting with C++14.
|
||||
// MSVC included them itself starting as of VS 2013 (our min supported version).
|
||||
// MSVC included them itself starting from VS2013 (our min supported version).
|
||||
// However, they can't be used via alias templates in VS2013 due to lack of
|
||||
// support for expression SFINAE.
|
||||
// Forward to their declarations as appropriate.
|
||||
//
|
||||
#if defined(HAVE_CXX14) || defined(_MSC_VER)
|
||||
#if defined(HAVE_CXX14) || _MSC_VER >= 1900
|
||||
|
||||
using std::add_const_t;
|
||||
using std::conditional_t;
|
||||
using std::enable_if_t;
|
||||
using std::remove_const_t;
|
||||
using std::remove_reference_t;
|
||||
using std::remove_pointer_t;
|
||||
template<typename T>
|
||||
using add_const_t = std::add_const_t<T>;
|
||||
template<bool B, typename T, typename F>
|
||||
using conditional_t = std::conditional_t<B, T, F>;
|
||||
template<bool B, typename T = void>
|
||||
using enable_if_t = std::enable_if_t<B, T>;
|
||||
template<typename T>
|
||||
using remove_const_t = std::remove_const_t<T>;
|
||||
template<typename T>
|
||||
using remove_reference_t = std::remove_reference_t<T>;
|
||||
template<typename T>
|
||||
using remove_pointer_t = std::remove_pointer_t<T>;
|
||||
|
||||
#else // We do not have C++14 or MSVC
|
||||
#else // We do not have C++14 or MSVC >= 2015
|
||||
|
||||
// add_const
|
||||
template<typename T>
|
||||
|
@ -59,7 +67,7 @@ using remove_reference_t = typename std::remove_reference<T>::type;
|
|||
template<typename T>
|
||||
using remove_pointer_t = typename std::remove_pointer<T>::type;
|
||||
|
||||
#endif // HAVE_CXX14
|
||||
#endif // defined(HAVE_CXX14) || _MSC_VER >= 1900
|
||||
|
||||
// Since there's really no way to implement these without variable templates, I've commented
|
||||
// this whole section out until we bump our min compiler support to VS 2015 and GCC 5.
|
||||
|
|
Loading…
Add table
Reference in a new issue