Skip to content

Commit 83716e6

Browse files
committed
草色烟光残照里,无言谁会凭阑意
恢复到C++20的概念
1 parent 7a2b0b4 commit 83716e6

File tree

7 files changed

+15
-16
lines changed

7 files changed

+15
-16
lines changed

others/Hanz2Piny.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Hanz2Piny::toPinyinFromUnicode (const Unicode hanzi_unicode, const bool with_ton
5959
// 不带声调
6060
vector<string> polyphone_list_without_tone;
6161
for (const auto& polyphone : polyphone_list_with_tone) {
62-
const auto& iter = std::find_if(polyphone.cbegin(), polyphone.cend(), isdigit);
62+
const auto& iter = std::ranges::find_if(polyphone.cbegin(), polyphone.cend(), isdigit);
6363
polyphone_list_without_tone.emplace_back(polyphone.cbegin(), iter);
6464
}
6565
return(polyphone_list_without_tone);

src/Engine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ int Engine::openAudio(int& freq, int& channels, int& size, int minsize, AudioCal
534534
channels = 2;
535535
}
536536
want.freq = freq;
537-
want.format = AUDIO_S16;
537+
want.format = AUDIO_F32;
538538
want.channels = channels;
539539
want.samples = size;
540540
want.callback = mixAudioCallback;

src/Event.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ class Event
174174
}
175175

176176
template <typename F, typename C, std::size_t... I>
177-
typename std::enable_if<check_return_type<F, C, void>::value, void>::type
178-
runner_impl(F f, C* c, const std::vector<int>& e, int& i, std::index_sequence<I...>)
177+
requires check_return_type<F, C, void>::value
178+
void runner_impl(F f, C* c, const std::vector<int>& e, int& i, std::index_sequence<I...>)
179179
{
180180
auto cur_i = i;
181181
i += sizeof...(I) + 1;
@@ -184,8 +184,8 @@ class Event
184184
}
185185

186186
template <typename F, typename C, std::size_t... I>
187-
typename std::enable_if<check_return_type<F, C, bool>::value, void>::type
188-
runner_impl(F f, C* c, const std::vector<int>& e, int& i, std::index_sequence<I...>)
187+
requires check_return_type<F, C, bool>::value
188+
void runner_impl(F f, C* c, const std::vector<int>& e, int& i, std::index_sequence<I...>)
189189
{
190190
auto cur_i = i;
191191
i += sizeof...(I) + 1;

src/Script.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
#include <array>
88
#include <functional>
99

10-
template <typename T>
11-
int rModifier(const std::string& data_name, T getDataFromIndex, lua_State* L)
10+
int rModifier(auto data_name, auto getDataFromIndex, lua_State* L)
1211
{
1312
int index = lua_tonumber(L, 1);
1413
std::string name = lua_tostring(L, 2);

src/Script.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ class Script
3838
}
3939

4040
template <typename F, typename C, std::size_t N>
41-
static typename std::enable_if<check_return_type<F, C, void>::value, int>::type
42-
runner(F f, C* c, const std::array<int, N>& e, lua_State* L)
41+
requires check_return_type<F, C, void>::value
42+
static int runner(F f, C* c, const std::array<int, N>& e, lua_State* L)
4343
{
4444
runner_impl(f, c, e, std::make_index_sequence<arg_counter<F, C>::value>{});
4545
return 0;
4646
}
4747

4848
template <typename F, typename C, std::size_t N>
49-
static typename std::enable_if<check_return_type<F, C, bool>::value, int>::type
50-
runner(F f, C* c, const std::array<int, N>& e, lua_State* L)
49+
requires check_return_type<F, C, bool>::value
50+
static int runner(F f, C* c, const std::array<int, N>& e, lua_State* L)
5151
{
5252
lua_pushboolean(L, runner_impl(f, c, e, std::make_index_sequence<arg_counter<F, C>::value>{}));
5353
return 1;

src/kys.vcxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@
9494
<PreprocessorDefinitions>WITH_SMALLPOT1;WITH_NETWORK;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
9595
<AdditionalIncludeDirectories>../include;../mod;.;$(VCPKG_LIB_PATH)\x64-windows\include;../mlcc;../local/include</AdditionalIncludeDirectories>
9696
<MultiProcessorCompilation>true</MultiProcessorCompilation>
97-
<LanguageStandard>stdcpp17</LanguageStandard>
97+
<LanguageStandard>stdcpplatest</LanguageStandard>
9898
<AdditionalOptions>/source-charset:utf-8 /execution-charset:utf-8 %(AdditionalOptions)</AdditionalOptions>
9999
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
100-
<ScanSourceForModuleDependencies>true</ScanSourceForModuleDependencies>
101-
<TranslateIncludes>true</TranslateIncludes>
100+
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
101+
<TranslateIncludes>false</TranslateIncludes>
102102
</ClCompile>
103103
<Link>
104104
<SubSystem>Console</SubSystem>

0 commit comments

Comments
 (0)