diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29b75b3..747b0a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,13 +24,13 @@ jobs: gcc_version: 11, } - # Clang-13 + # Clang-14 - { - name: "Linux Clang 13", + name: "Linux Clang 14", os: ubuntu-20.04, build_type: Release, - cxx: "clang++-13", - clang_version: 13, + cxx: "clang++-14", + clang_version: 14, libcxx: true } @@ -48,7 +48,7 @@ jobs: os: windows-latest, build_type: Release, cxx: "cl", - environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", + environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat", } steps: @@ -98,7 +98,7 @@ jobs: ) endif() - - name: Install Clang 13 + - name: Install Clang 14 id: install_clang_11 if: startsWith(matrix.config.os, 'ubuntu') && startsWith(matrix.config.cxx, 'clang++-') shell: bash @@ -133,6 +133,10 @@ jobs: run: | sudo apt-get install libc++-${{ matrix.config.clang_version }}-dev libc++abi-${{ matrix.config.clang_version }}-dev + - name: Setup MSVC Dev + if: "startsWith(matrix.config.os, 'Windows')" + uses: ilammy/msvc-dev-cmd@v1 + - name: Configure id: cmake_configure shell: cmake -P {0} diff --git a/01.01-variadicTemplateSum2/CMakeLists.txt b/01.01-variadicTemplateSum2/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/01.01-variadicTemplateSum2/CMakeLists.txt +++ b/01.01-variadicTemplateSum2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.02-variableTemplate0/CMakeLists.txt b/01.02-variableTemplate0/CMakeLists.txt index c24e024..14b1ad9 100644 --- a/01.02-variableTemplate0/CMakeLists.txt +++ b/01.02-variableTemplate0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.05-variadicTemplateSum3/CMakeLists.txt b/01.05-variadicTemplateSum3/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.05-variadicTemplateSum3/CMakeLists.txt +++ b/01.05-variadicTemplateSum3/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.06-simpleRequirement0/CMakeLists.txt b/01.06-simpleRequirement0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.06-simpleRequirement0/CMakeLists.txt +++ b/01.06-simpleRequirement0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.07-nestedRequirement0/CMakeLists.txt b/01.07-nestedRequirement0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.07-nestedRequirement0/CMakeLists.txt +++ b/01.07-nestedRequirement0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.08-compoundRequirement0/CMakeLists.txt b/01.08-compoundRequirement0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.08-compoundRequirement0/CMakeLists.txt +++ b/01.08-compoundRequirement0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.09-typeRequirement0/CMakeLists.txt b/01.09-typeRequirement0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.09-typeRequirement0/CMakeLists.txt +++ b/01.09-typeRequirement0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.10-compoundRequirement1/CMakeLists.txt b/01.10-compoundRequirement1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.10-compoundRequirement1/CMakeLists.txt +++ b/01.10-compoundRequirement1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.11-compoundRequirement2/CMakeLists.txt b/01.11-compoundRequirement2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.11-compoundRequirement2/CMakeLists.txt +++ b/01.11-compoundRequirement2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.12-testingRequirements0/CMakeLists.txt b/01.12-testingRequirements0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.12-testingRequirements0/CMakeLists.txt +++ b/01.12-testingRequirements0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.14-invocable0/CMakeLists.txt b/01.14-invocable0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.14-invocable0/CMakeLists.txt +++ b/01.14-invocable0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.15-invocable1/CMakeLists.txt b/01.15-invocable1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.15-invocable1/CMakeLists.txt +++ b/01.15-invocable1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.16-constexprFunctionInConcept0/CMakeLists.txt b/01.16-constexprFunctionInConcept0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.16-constexprFunctionInConcept0/CMakeLists.txt +++ b/01.16-constexprFunctionInConcept0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.16-constexprFunctionInConcept0/main.cpp b/01.16-constexprFunctionInConcept0/main.cpp index 291e988..8d438fe 100644 --- a/01.16-constexprFunctionInConcept0/main.cpp +++ b/01.16-constexprFunctionInConcept0/main.cpp @@ -4,7 +4,6 @@ #include #include -#if not defined(_MSC_VER) // #A A helper function with a default parameter constexpr auto GetSize(const auto& t = {}) { @@ -25,10 +24,4 @@ int main() std::array a{}; SendOnePing(a); -} -#else -int main() -{ -# pragma message("not supported") -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/01.18-vectorsSize0/CMakeLists.txt b/01.18-vectorsSize0/CMakeLists.txt index 2f2d123..9566747 100644 --- a/01.18-vectorsSize0/CMakeLists.txt +++ b/01.18-vectorsSize0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.21-vectorsSize1/CMakeLists.txt b/01.21-vectorsSize1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.21-vectorsSize1/CMakeLists.txt +++ b/01.21-vectorsSize1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.22-validateInDebugModeIfExists0/CMakeLists.txt b/01.22-validateInDebugModeIfExists0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.22-validateInDebugModeIfExists0/CMakeLists.txt +++ b/01.22-validateInDebugModeIfExists0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.24-optional0/CMakeLists.txt b/01.24-optional0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/01.24-optional0/CMakeLists.txt +++ b/01.24-optional0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.26-optional1/CMakeLists.txt b/01.26-optional1/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/01.26-optional1/CMakeLists.txt +++ b/01.26-optional1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.26-optional1/main.cpp b/01.26-optional1/main.cpp index 314f9ca..d31a99d 100644 --- a/01.26-optional1/main.cpp +++ b/01.26-optional1/main.cpp @@ -6,7 +6,7 @@ struct copyable {}; struct notCopyable { - notCopyable(const notCopyable&) = delete; + notCopyable(const notCopyable&) = delete; notCopyable operator=(const notCopyable&) = delete; }; @@ -20,7 +20,7 @@ class optional }; struct NotCopyable { - NotCopyable(const NotCopyable&) = delete; + NotCopyable(const NotCopyable&) = delete; NotCopyable& operator=(const NotCopyable&) = delete; }; diff --git a/01.27-optional2/CMakeLists.txt b/01.27-optional2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.27-optional2/CMakeLists.txt +++ b/01.27-optional2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.27-optional2/main.cpp b/01.27-optional2/main.cpp index b734bcb..0849dff 100644 --- a/01.27-optional2/main.cpp +++ b/01.27-optional2/main.cpp @@ -18,7 +18,7 @@ optional::optional( {} struct NotCopyable { - NotCopyable(const NotCopyable&) = delete; + NotCopyable(const NotCopyable&) = delete; NotCopyable& operator=(const NotCopyable&) = delete; }; diff --git a/01.28-optional3/CMakeLists.txt b/01.28-optional3/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.28-optional3/CMakeLists.txt +++ b/01.28-optional3/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.28-optional3/main.cpp b/01.28-optional3/main.cpp index 4ae36f1..4b9f957 100644 --- a/01.28-optional3/main.cpp +++ b/01.28-optional3/main.cpp @@ -40,7 +40,7 @@ class optional { }; struct NotCopyable { - NotCopyable(const NotCopyable&) = delete; + NotCopyable(const NotCopyable&) = delete; NotCopyable& operator=(const NotCopyable&) = delete; }; diff --git a/01.29-optional4/CMakeLists.txt b/01.29-optional4/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.29-optional4/CMakeLists.txt +++ b/01.29-optional4/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.29-optional4/main.cpp b/01.29-optional4/main.cpp index 4a48f64..787807a 100644 --- a/01.29-optional4/main.cpp +++ b/01.29-optional4/main.cpp @@ -71,7 +71,7 @@ class optional { #endif struct NotCopyable { - NotCopyable(const NotCopyable&) = delete; + NotCopyable(const NotCopyable&) = delete; NotCopyable& operator=(const NotCopyable&) = delete; }; diff --git a/01.32-optional5/CMakeLists.txt b/01.32-optional5/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.32-optional5/CMakeLists.txt +++ b/01.32-optional5/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.32-optional5/main.cpp b/01.32-optional5/main.cpp index b12e91c..b8ca6ac 100644 --- a/01.32-optional5/main.cpp +++ b/01.32-optional5/main.cpp @@ -84,7 +84,7 @@ optional::~optional() requires NotTriviallyDestructible && #endif struct NotCopyable { - NotCopyable(const NotCopyable&) = delete; + NotCopyable(const NotCopyable&) = delete; NotCopyable& operator=(const NotCopyable&) = delete; }; diff --git a/01.33-optional6/CMakeLists.txt b/01.33-optional6/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.33-optional6/CMakeLists.txt +++ b/01.33-optional6/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.33-optional6/main.cpp b/01.33-optional6/main.cpp index 1270fe4..2ade93c 100644 --- a/01.33-optional6/main.cpp +++ b/01.33-optional6/main.cpp @@ -100,7 +100,7 @@ optional::~optional() requires NotTriviallyDestructible && #endif struct NotCopyable { - NotCopyable(const NotCopyable&) = delete; + NotCopyable(const NotCopyable&) = delete; NotCopyable& operator=(const NotCopyable&) = delete; }; diff --git a/01.34-isSameConcept0/CMakeLists.txt b/01.34-isSameConcept0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.34-isSameConcept0/CMakeLists.txt +++ b/01.34-isSameConcept0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.36-isSameConcept1/CMakeLists.txt b/01.36-isSameConcept1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.36-isSameConcept1/CMakeLists.txt +++ b/01.36-isSameConcept1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.37-isSameConcept2/CMakeLists.txt b/01.37-isSameConcept2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.37-isSameConcept2/CMakeLists.txt +++ b/01.37-isSameConcept2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.38-isSameConcept3/CMakeLists.txt b/01.38-isSameConcept3/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.38-isSameConcept3/CMakeLists.txt +++ b/01.38-isSameConcept3/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.40-printSorted0/CMakeLists.txt b/01.40-printSorted0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/01.40-printSorted0/CMakeLists.txt +++ b/01.40-printSorted0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/01.42-printSorted1/CMakeLists.txt b/01.42-printSorted1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/01.42-printSorted1/CMakeLists.txt +++ b/01.42-printSorted1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/02.01-limitlessSequenceWithoutCoroutines0/CMakeLists.txt b/02.01-limitlessSequenceWithoutCoroutines0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/02.01-limitlessSequenceWithoutCoroutines0/CMakeLists.txt +++ b/02.01-limitlessSequenceWithoutCoroutines0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/02.03-limitlessSequenceWithFunctionTemplate0/CMakeLists.txt b/02.03-limitlessSequenceWithFunctionTemplate0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/02.03-limitlessSequenceWithFunctionTemplate0/CMakeLists.txt +++ b/02.03-limitlessSequenceWithFunctionTemplate0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/02.04-coroutineLimitlessSequence0/CMakeLists.txt b/02.04-coroutineLimitlessSequence0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/02.04-coroutineLimitlessSequence0/CMakeLists.txt +++ b/02.04-coroutineLimitlessSequence0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/02.04-coroutineLimitlessSequence0/main.cpp b/02.04-coroutineLimitlessSequence0/main.cpp index 300af62..884a0fe 100644 --- a/02.04-coroutineLimitlessSequence0/main.cpp +++ b/02.04-coroutineLimitlessSequence0/main.cpp @@ -1,25 +1,8 @@ // Copyright (c) Andreas Fertig. // SPDX-License-Identifier: MIT -#include - -#if __has_include() -# include - -namespace std { - using namespace std::experimental; -} -#elif __has_include() -#if __has_include() -#include -namespace std { using namespace std::experimental; } -#elif __has_include() +#include #include -#endif -#else -# pragma message("not supported") -#endif - #include #include #include diff --git a/02.08-parsingDataStream0/CMakeLists.txt b/02.08-parsingDataStream0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/02.08-parsingDataStream0/CMakeLists.txt +++ b/02.08-parsingDataStream0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/02.10-coroutineParsingDataStream0/CMakeLists.txt b/02.10-coroutineParsingDataStream0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/02.10-coroutineParsingDataStream0/CMakeLists.txt +++ b/02.10-coroutineParsingDataStream0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/02.10-coroutineParsingDataStream0/main.cpp b/02.10-coroutineParsingDataStream0/main.cpp index 0540116..2581a1c 100644 --- a/02.10-coroutineParsingDataStream0/main.cpp +++ b/02.10-coroutineParsingDataStream0/main.cpp @@ -2,12 +2,7 @@ // SPDX-License-Identifier: MIT #include -#if __has_include() -#include -namespace std { using namespace std::experimental; } -#elif __has_include() #include -#endif #include #include #include @@ -92,7 +87,7 @@ struct awaitable_promise_type_base { struct awaiter { std::optional& mRecentSignal; - bool await_ready() { return mRecentSignal.has_value(); } + bool await_ready() const { return mRecentSignal.has_value(); } void await_suspend(std::coroutine_handle<>) {} T await_resume() @@ -245,9 +240,15 @@ void ProcessStream(generator& stream, FSM& parse) } -void Use() + +void HandleFrame(const std::string& frame) { -std::vector fakeBytes1{ + printf("%s\n", frame.c_str()); +} + +int main() +{ + std::vector fakeBytes1{ 0x70_B, ESC, SOF, ESC, 'H'_B, 'e'_B, 'l'_B, 'l'_B, 'o'_B, ESC, SOF, 0x7_B, ESC, SOF}; @@ -270,15 +271,4 @@ auto stream2 = sender(std::move(fakeBytes2)); // #F We still use the former p and feed it with new bytes ProcessStream(stream2, p); -} - - -void HandleFrame(const std::string& frame) -{ - printf("%s\n", frame.c_str()); -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/02.18-coroutineParsingDataStream1/CMakeLists.txt b/02.18-coroutineParsingDataStream1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/02.18-coroutineParsingDataStream1/CMakeLists.txt +++ b/02.18-coroutineParsingDataStream1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/02.18-coroutineParsingDataStream1/main.cpp b/02.18-coroutineParsingDataStream1/main.cpp index 9a6af6a..32b435c 100644 --- a/02.18-coroutineParsingDataStream1/main.cpp +++ b/02.18-coroutineParsingDataStream1/main.cpp @@ -2,14 +2,7 @@ // SPDX-License-Identifier: MIT #include -#if __has_include() -# include -namespace std { - using namespace std::experimental; -} -#elif __has_include() -# include -#endif +#include #include #include #include @@ -243,7 +236,12 @@ generator sender(std::vector fakeBytes) void HandleFrame(const std::string& frame); -void Use() +void HandleFrame(const std::string& frame) +{ + printf("%s\n", frame.c_str()); +} + +int main() { std::vector fakeBytes1{0x70_B, ESC, @@ -290,14 +288,4 @@ void Use() HandleFrame(res); } } -} - -void HandleFrame(const std::string& frame) -{ - printf("%s\n", frame.c_str()); -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/02.24-coroutineParsingDataStreamCustomAllocator0/CMakeLists.txt b/02.24-coroutineParsingDataStreamCustomAllocator0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/02.24-coroutineParsingDataStreamCustomAllocator0/CMakeLists.txt +++ b/02.24-coroutineParsingDataStreamCustomAllocator0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/02.24-coroutineParsingDataStreamCustomAllocator0/main.cpp b/02.24-coroutineParsingDataStreamCustomAllocator0/main.cpp index 7322489..7c8ee00 100644 --- a/02.24-coroutineParsingDataStreamCustomAllocator0/main.cpp +++ b/02.24-coroutineParsingDataStreamCustomAllocator0/main.cpp @@ -2,14 +2,7 @@ // SPDX-License-Identifier: MIT #include -#if __has_include() -# include -namespace std { - using namespace std::experimental; -} -#elif __has_include() -# include -#endif +#include #include #include #include @@ -269,7 +262,12 @@ generator sender(std::vector fakeBytes) void HandleFrame(const std::string& frame); -void Use() +void HandleFrame(const std::string& frame) +{ + printf("%s\n", frame.c_str()); +} + +int main() { std::vector fakeBytes1{0x70_B, ESC, @@ -316,14 +314,4 @@ void Use() HandleFrame(res); } } -} - -void HandleFrame(const std::string& frame) -{ - printf("%s\n", frame.c_str()); -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/02.25-coroutineParsingDataStreamCustomAllocator1/CMakeLists.txt b/02.25-coroutineParsingDataStreamCustomAllocator1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/02.25-coroutineParsingDataStreamCustomAllocator1/CMakeLists.txt +++ b/02.25-coroutineParsingDataStreamCustomAllocator1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/02.25-coroutineParsingDataStreamCustomAllocator1/main.cpp b/02.25-coroutineParsingDataStreamCustomAllocator1/main.cpp index d5b71fe..186f5e0 100644 --- a/02.25-coroutineParsingDataStreamCustomAllocator1/main.cpp +++ b/02.25-coroutineParsingDataStreamCustomAllocator1/main.cpp @@ -2,14 +2,7 @@ // SPDX-License-Identifier: MIT #include -#if __has_include() -# include -namespace std { - using namespace std::experimental; -} -#elif __has_include() -# include -#endif +#include #include #include #include @@ -296,7 +289,12 @@ generator sender(arena& a, std::vector fakeBytes) void HandleFrame(const std::string& frame); -void Use() +void HandleFrame(const std::string& frame) +{ + printf("%s\n", frame.c_str()); +} + +int main() { std::vector fakeBytes1{0x70_B, ESC, @@ -349,14 +347,4 @@ void Use() HandleFrame(res); } } -} - -void HandleFrame(const std::string& frame) -{ - printf("%s\n", frame.c_str()); -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/02.27-coroutineParsingDataStreamException0/CMakeLists.txt b/02.27-coroutineParsingDataStreamException0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/02.27-coroutineParsingDataStreamException0/CMakeLists.txt +++ b/02.27-coroutineParsingDataStreamException0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/02.27-coroutineParsingDataStreamException0/main.cpp b/02.27-coroutineParsingDataStreamException0/main.cpp index 83a727a..f42dc33 100644 --- a/02.27-coroutineParsingDataStreamException0/main.cpp +++ b/02.27-coroutineParsingDataStreamException0/main.cpp @@ -2,14 +2,7 @@ // SPDX-License-Identifier: MIT #include -#if __has_include() -# include -namespace std { - using namespace std::experimental; -} -#elif __has_include() -# include -#endif +#include #include #include #include @@ -290,8 +283,35 @@ generator sender(std::vector fakeBytes) void HandleFrame(const std::string& frame); void PrintException(std::runtime_error& rt); -void Use() +void HandleFrame(const std::string& frame) +{ + printf("%s\n", frame.c_str()); +} + +void PrintException(std::runtime_error& rt) { + std::cout << "ex: " << rt.what() << '\n'; +} + +int main(int argc, char* argv[]) +{ + + if(argc > 2) { + rethrow = atoi(argv[1]); + + if("ParseBegin"s == argv[2]) { + ex = Ex::ParseBegin; + } else if("ParseWhileRunning"s == argv[2]) { + ex = Ex::ParseWhileRunning; + } else if("InitialSuspend"s == argv[2]) { + ex = Ex::InitialSuspend; + } else if("YieldValue"s == argv[2]) { + ex = Ex::YieldValue; + } else if("GetReturnObject"s == argv[2]) { + ex = Ex::GetReturnObject; + } + } + std::vector fakeBytes1{0x70_B, ESC, SOF, @@ -327,36 +347,4 @@ void Use() } catch(std::runtime_error& rt) { PrintException(rt); } -} - -void HandleFrame(const std::string& frame) -{ - printf("%s\n", frame.c_str()); -} - -void PrintException(std::runtime_error& rt) -{ - std::cout << "ex: " << rt.what() << '\n'; -} - -int main(int argc, char* argv[]) -{ - - if(argc > 2) { - rethrow = atoi(argv[1]); - - if("ParseBegin"s == argv[2]) { - ex = Ex::ParseBegin; - } else if("ParseWhileRunning"s == argv[2]) { - ex = Ex::ParseWhileRunning; - } else if("InitialSuspend"s == argv[2]) { - ex = Ex::InitialSuspend; - } else if("YieldValue"s == argv[2]) { - ex = Ex::YieldValue; - } else if("GetReturnObject"s == argv[2]) { - ex = Ex::GetReturnObject; - } - } - - Use(); } \ No newline at end of file diff --git a/03.01-rangesMotivation0/CMakeLists.txt b/03.01-rangesMotivation0/CMakeLists.txt index 2f2d123..9566747 100644 --- a/03.01-rangesMotivation0/CMakeLists.txt +++ b/03.01-rangesMotivation0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.02-rangesMotivation1/CMakeLists.txt b/03.02-rangesMotivation1/CMakeLists.txt index 2f2d123..9566747 100644 --- a/03.02-rangesMotivation1/CMakeLists.txt +++ b/03.02-rangesMotivation1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.03-rangesMotivation2/CMakeLists.txt b/03.03-rangesMotivation2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/03.03-rangesMotivation2/CMakeLists.txt +++ b/03.03-rangesMotivation2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.04-twoStepUsing0/CMakeLists.txt b/03.04-twoStepUsing0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/03.04-twoStepUsing0/CMakeLists.txt +++ b/03.04-twoStepUsing0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.05-twoStepUsing1/CMakeLists.txt b/03.05-twoStepUsing1/CMakeLists.txt index 2944c7b..6c3ef8c 100644 --- a/03.05-twoStepUsing1/CMakeLists.txt +++ b/03.05-twoStepUsing1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.05-twoStepUsing1/main.cpp b/03.05-twoStepUsing1/main.cpp index 325ead9..3ceea12 100644 --- a/03.05-twoStepUsing1/main.cpp +++ b/03.05-twoStepUsing1/main.cpp @@ -26,7 +26,7 @@ void Use(auto& c) begin(c); } -void Use() +int main() { Container c{}; @@ -35,9 +35,4 @@ void Use() OtherContainer oc{}; Use(oc); -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/03.06-twoStepUsing2/CMakeLists.txt b/03.06-twoStepUsing2/CMakeLists.txt index 2944c7b..6c3ef8c 100644 --- a/03.06-twoStepUsing2/CMakeLists.txt +++ b/03.06-twoStepUsing2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.06-twoStepUsing2/main.cpp b/03.06-twoStepUsing2/main.cpp index 127791b..a02f154 100644 --- a/03.06-twoStepUsing2/main.cpp +++ b/03.06-twoStepUsing2/main.cpp @@ -26,7 +26,7 @@ void Use(auto& c) std::ranges::begin(c); } -void Use() +int main() { Container c{}; @@ -37,11 +37,6 @@ void Use() Use(oc); } -int main() -{ - Use(); -} - #else int main() diff --git a/03.07-rangesSafety0/CMakeLists.txt b/03.07-rangesSafety0/CMakeLists.txt index d92abf1..6c1466a 100644 --- a/03.07-rangesSafety0/CMakeLists.txt +++ b/03.07-rangesSafety0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.07-rangesSafety0/main.cpp b/03.07-rangesSafety0/main.cpp index 035252d..9549724 100644 --- a/03.07-rangesSafety0/main.cpp +++ b/03.07-rangesSafety0/main.cpp @@ -3,12 +3,7 @@ #include -void Use() -{ - auto it = std::begin(std::string{"Urg"}); -} - int main() { - Use(); + auto it = std::begin(std::string{"Urg"}); } \ No newline at end of file diff --git a/03.08-rangesSafety1/CMakeLists.txt b/03.08-rangesSafety1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/03.08-rangesSafety1/CMakeLists.txt +++ b/03.08-rangesSafety1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.08-rangesSafety1/main.cpp b/03.08-rangesSafety1/main.cpp index 20e4572..2d13ead 100644 --- a/03.08-rangesSafety1/main.cpp +++ b/03.08-rangesSafety1/main.cpp @@ -1,22 +1,13 @@ // Copyright (c) Andreas Fertig. // SPDX-License-Identifier: MIT -#if __has_include() and not defined(__clang__) - -# include -# include +#include +#include int main() { -# if WILL_NOT_COMPILE +#if WILL_NOT_COMPILE auto it = std::ranges::begin(std::string{"Urg"}); -# endif /* WILL_NOT_COMPILE */ -} - -#else -int main() -{ -# pragma message("not supported") -} -#endif \ No newline at end of file +#endif /* WILL_NOT_COMPILE */ +} \ No newline at end of file diff --git a/03.09-rangesMotivationComposability0/CMakeLists.txt b/03.09-rangesMotivationComposability0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/03.09-rangesMotivationComposability0/CMakeLists.txt +++ b/03.09-rangesMotivationComposability0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.10-rangesMotivationComposability1/CMakeLists.txt b/03.10-rangesMotivationComposability1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/03.10-rangesMotivationComposability1/CMakeLists.txt +++ b/03.10-rangesMotivationComposability1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.11-aRange0/CMakeLists.txt b/03.11-aRange0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/03.11-aRange0/CMakeLists.txt +++ b/03.11-aRange0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.11-aRange0/main.cpp b/03.11-aRange0/main.cpp index 4bc24e0..4573985 100644 --- a/03.11-aRange0/main.cpp +++ b/03.11-aRange0/main.cpp @@ -27,8 +27,14 @@ namespace rnges { std::default_sentinel_t end(); }; - T Range::begin() { return {}; } - - std::default_sentinel_t Range::end() { return {}; } + T Range::begin() + { + return {}; + } + + std::default_sentinel_t Range::end() + { + return {}; + } } // namespace rnges int main() {} diff --git a/03.13-rangesCommonView1/CMakeLists.txt b/03.13-rangesCommonView1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/03.13-rangesCommonView1/CMakeLists.txt +++ b/03.13-rangesCommonView1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.14-rangesCommonView2/CMakeLists.txt b/03.14-rangesCommonView2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/03.14-rangesCommonView2/CMakeLists.txt +++ b/03.14-rangesCommonView2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.15-rangesProjection0/CMakeLists.txt b/03.15-rangesProjection0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/03.15-rangesProjection0/CMakeLists.txt +++ b/03.15-rangesProjection0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.15-rangesProjection0/main.cpp b/03.15-rangesProjection0/main.cpp index 5261eb7..5dfb5d2 100644 --- a/03.15-rangesProjection0/main.cpp +++ b/03.15-rangesProjection0/main.cpp @@ -6,7 +6,7 @@ #include #include -void Use() +int main() { struct Book { std::string title; @@ -23,9 +23,4 @@ void Use() }); for(const auto& book : books) { std::cout << book.title << '\n'; } -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/03.17-rangesProjection1/CMakeLists.txt b/03.17-rangesProjection1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/03.17-rangesProjection1/CMakeLists.txt +++ b/03.17-rangesProjection1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.17-rangesProjection1/main.cpp b/03.17-rangesProjection1/main.cpp index bd4d5bc..16b2372 100644 --- a/03.17-rangesProjection1/main.cpp +++ b/03.17-rangesProjection1/main.cpp @@ -8,7 +8,7 @@ # include # include -void Use() +int main() { struct Book { std::string title; @@ -24,11 +24,6 @@ void Use() for(const auto& book : books) { std::cout << book.title << '\n'; } } -int main() -{ - Use(); -} - #else int main() diff --git a/03.18-rangesMotivationComposability2/CMakeLists.txt b/03.18-rangesMotivationComposability2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/03.18-rangesMotivationComposability2/CMakeLists.txt +++ b/03.18-rangesMotivationComposability2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.19-rangesCustomAdaptor0/CMakeLists.txt b/03.19-rangesCustomAdaptor0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/03.19-rangesCustomAdaptor0/CMakeLists.txt +++ b/03.19-rangesCustomAdaptor0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.19-rangesCustomAdaptor0/main.cpp b/03.19-rangesCustomAdaptor0/main.cpp index fff1ad2..9c434d4 100644 --- a/03.19-rangesCustomAdaptor0/main.cpp +++ b/03.19-rangesCustomAdaptor0/main.cpp @@ -8,7 +8,7 @@ # include # include -void Use() +int main() { std::string suffix{"EUR"}; const std::vector prices{3.95, 6.0, 95.4, 10.95, 12.90, 5.50}; @@ -22,11 +22,6 @@ void Use() for(const auto& e : subView) { std::cout << e << '\n'; } } -int main() -{ - Use(); -} - #else int main() diff --git a/03.20-rangesCustomAdaptor1/CMakeLists.txt b/03.20-rangesCustomAdaptor1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/03.20-rangesCustomAdaptor1/CMakeLists.txt +++ b/03.20-rangesCustomAdaptor1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.20-rangesCustomAdaptor1/main.cpp b/03.20-rangesCustomAdaptor1/main.cpp index 8f45400..d21fb6d 100644 --- a/03.20-rangesCustomAdaptor1/main.cpp +++ b/03.20-rangesCustomAdaptor1/main.cpp @@ -16,7 +16,7 @@ auto addCurrency(const std::string& suffix) [suffix](auto i) { return std::to_string(i) + suffix; }); } -void Use() +int main() { const std::vector prices{3.95, 6.0, 95.4, 10.95, 12.90, 5.50}; @@ -29,11 +29,6 @@ void Use() for(const auto& e : subView) { std::cout << e << '\n'; } } -int main() -{ - Use(); -} - #else int main() diff --git a/03.22-rangesNamespaces0/CMakeLists.txt b/03.22-rangesNamespaces0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/03.22-rangesNamespaces0/CMakeLists.txt +++ b/03.22-rangesNamespaces0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.23-rangesCustomTakeView0/CMakeLists.txt b/03.23-rangesCustomTakeView0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/03.23-rangesCustomTakeView0/CMakeLists.txt +++ b/03.23-rangesCustomTakeView0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/03.29-rangesCustomTakeView1/CMakeLists.txt b/03.29-rangesCustomTakeView1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/03.29-rangesCustomTakeView1/CMakeLists.txt +++ b/03.29-rangesCustomTakeView1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/04.01-includeHell0/CMakeLists.txt b/04.01-includeHell0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/04.01-includeHell0/CMakeLists.txt +++ b/04.01-includeHell0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/04.03-moduleSkeleton0/CMakeLists.txt b/04.03-moduleSkeleton0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/04.03-moduleSkeleton0/CMakeLists.txt +++ b/04.03-moduleSkeleton0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/04.03-moduleSkeleton0/main.cpp b/04.03-moduleSkeleton0/main.cpp index 9d5c941..daed3f5 100644 --- a/04.03-moduleSkeleton0/main.cpp +++ b/04.03-moduleSkeleton0/main.cpp @@ -2,10 +2,10 @@ // SPDX-License-Identifier: MIT #if 0 -module; ///\lc{A}{Starts the module, only required, if we have legacy includes} +module; // #A Starts the module, only required, if we have legacy includes // Global module fragment, legacy #includes go here -[export] module AwesomeModule; ///\lc{B}{Export if it is an interface} +[export] module AwesomeModule; // #B Export if it is an interface // Module Purview, imports go here import x; // #C Import something only visible in the module diff --git a/04.04-namespaceDetails0/CMakeLists.txt b/04.04-namespaceDetails0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/04.04-namespaceDetails0/CMakeLists.txt +++ b/04.04-namespaceDetails0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/04.05-namespaceDetails1/CMakeLists.txt b/04.05-namespaceDetails1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/04.05-namespaceDetails1/CMakeLists.txt +++ b/04.05-namespaceDetails1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/04.06-downWithDebug0/CMakeLists.txt b/04.06-downWithDebug0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/04.06-downWithDebug0/CMakeLists.txt +++ b/04.06-downWithDebug0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/04.10-downWithDebug1/CMakeLists.txt b/04.10-downWithDebug1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/04.10-downWithDebug1/CMakeLists.txt +++ b/04.10-downWithDebug1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/04.11-inClassMemberFunction0/CMakeLists.txt b/04.11-inClassMemberFunction0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/04.11-inClassMemberFunction0/CMakeLists.txt +++ b/04.11-inClassMemberFunction0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/04.12-assertImpl0/CMakeLists.txt b/04.12-assertImpl0/CMakeLists.txt index 2f2d123..9566747 100644 --- a/04.12-assertImpl0/CMakeLists.txt +++ b/04.12-assertImpl0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.01-stdFmtStockIndex0/CMakeLists.txt b/05.01-stdFmtStockIndex0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.01-stdFmtStockIndex0/CMakeLists.txt +++ b/05.01-stdFmtStockIndex0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.01-stdFmtStockIndex0/main.cpp b/05.01-stdFmtStockIndex0/main.cpp index 4928adc..eea7ff1 100644 --- a/05.01-stdFmtStockIndex0/main.cpp +++ b/05.01-stdFmtStockIndex0/main.cpp @@ -116,7 +116,7 @@ void WithStdFormat() } } -void Use() +int main() { WithPrintf(); std::cout << '\n'; @@ -132,11 +132,6 @@ void Use() WithStdFormat(); } -int main() -{ - Use(); -} - #else int main() { diff --git a/05.03-digitSeparator0/CMakeLists.txt b/05.03-digitSeparator0/CMakeLists.txt index c24e024..14b1ad9 100644 --- a/05.03-digitSeparator0/CMakeLists.txt +++ b/05.03-digitSeparator0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.04-stdFmtStockIndexIostream0/CMakeLists.txt b/05.04-stdFmtStockIndexIostream0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/05.04-stdFmtStockIndexIostream0/CMakeLists.txt +++ b/05.04-stdFmtStockIndexIostream0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.04-stdFmtStockIndexIostream0/main.cpp b/05.04-stdFmtStockIndexIostream0/main.cpp index c0c0f9b..e82f1e4 100644 --- a/05.04-stdFmtStockIndexIostream0/main.cpp +++ b/05.04-stdFmtStockIndexIostream0/main.cpp @@ -52,16 +52,11 @@ std::vector GetIndices() return {dax, dow, sp}; } -void Use() +int main() { for(const auto& index : GetIndices()) { std::cout << index.name() << " " << index.points() << " " << index.pointsDiff() << " " << index.pointsPercent() << '%' << '\n'; } -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/05.07-stdFmtStockIndexIostreamLocalized0/CMakeLists.txt b/05.07-stdFmtStockIndexIostreamLocalized0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/05.07-stdFmtStockIndexIostreamLocalized0/CMakeLists.txt +++ b/05.07-stdFmtStockIndexIostreamLocalized0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.07-stdFmtStockIndexIostreamLocalized0/main.cpp b/05.07-stdFmtStockIndexIostreamLocalized0/main.cpp index cee1789..5aa33c7 100644 --- a/05.07-stdFmtStockIndexIostreamLocalized0/main.cpp +++ b/05.07-stdFmtStockIndexIostreamLocalized0/main.cpp @@ -52,7 +52,7 @@ std::vector GetIndices() return {dax, dow, sp}; } -void Use() +int main() { for(const auto& index : GetIndices()) { std::cout << std::fixed; @@ -66,9 +66,4 @@ void Use() << index.pointsDiff() << " " << index.pointsPercent() << '%' << '\n'; } -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/05.10-stdFmtEscape0/CMakeLists.txt b/05.10-stdFmtEscape0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.10-stdFmtEscape0/CMakeLists.txt +++ b/05.10-stdFmtEscape0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.10-stdFmtEscape0/main.cpp b/05.10-stdFmtEscape0/main.cpp index f2133ab..f5770b5 100644 --- a/05.10-stdFmtEscape0/main.cpp +++ b/05.10-stdFmtEscape0/main.cpp @@ -6,14 +6,9 @@ # include # include -void Use() -{ - std::cout << std::format("Having the }} in a {}.", "string"); -} - int main() { - Use(); + std::cout << std::format("Having the }} in a {}.", "string"); std::cout << '\n'; } diff --git a/05.11-stdFmtLocale0/CMakeLists.txt b/05.11-stdFmtLocale0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.11-stdFmtLocale0/CMakeLists.txt +++ b/05.11-stdFmtLocale0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.11-stdFmtLocale0/main.cpp b/05.11-stdFmtLocale0/main.cpp index 2d0528d..8017fde 100644 --- a/05.11-stdFmtLocale0/main.cpp +++ b/05.11-stdFmtLocale0/main.cpp @@ -10,8 +10,9 @@ using namespace std::literals; -void Use() +int main() { +# if not(defined(__GNUC__) && !defined(__clang__)) const double pi = 3.14; const int i = 1'024; @@ -33,12 +34,7 @@ void Use() std::cout << "\nint with format(...) after setting global loc\n"; std::cout << std::format("1'024 in US: {:L}\n", i); -} -int main() -{ -# if not(defined(__GNUC__) && !defined(__clang__)) - Use(); # endif } diff --git a/05.12-stdFmtFloatFormatting0/CMakeLists.txt b/05.12-stdFmtFloatFormatting0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.12-stdFmtFloatFormatting0/CMakeLists.txt +++ b/05.12-stdFmtFloatFormatting0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.13-stdFmtStockIndexCustomFormatter0/CMakeLists.txt b/05.13-stdFmtStockIndexCustomFormatter0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.13-stdFmtStockIndexCustomFormatter0/CMakeLists.txt +++ b/05.13-stdFmtStockIndexCustomFormatter0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.13-stdFmtStockIndexCustomFormatter0/main.cpp b/05.13-stdFmtStockIndexCustomFormatter0/main.cpp index 42fbc10..def06db 100644 --- a/05.13-stdFmtStockIndexCustomFormatter0/main.cpp +++ b/05.13-stdFmtStockIndexCustomFormatter0/main.cpp @@ -1,8 +1,7 @@ // Copyright (c) Andreas Fertig. // SPDX-License-Identifier: MIT -#if __has_include( \ - ) and not defined(__clang__) && not defined(_MSC_VER) +#if __has_include() and not defined(__clang__) # include # include # include @@ -58,12 +57,12 @@ std::vector GetIndices() template<> struct std::formatter { - constexpr auto parse(format_parse_context& ctx) + constexpr auto parse(std::format_parse_context& ctx) { return ctx.begin(); } - auto format(const StockIndex& index, format_context& ctx) + auto format(const StockIndex& index, std::format_context& ctx) { return std::format_to(ctx.out(), "{:10} {:>8.2f} {:>6.2f} {:.2f}%", @@ -74,18 +73,13 @@ struct std::formatter { } }; -void Use() +int main() { for(const auto& index : GetIndices()) { std::cout << std::format("{}\n", index); } } -int main() -{ - Use(); -} - #else int main() { diff --git a/05.15-stdFmtStockIndexCustomFormatter1/CMakeLists.txt b/05.15-stdFmtStockIndexCustomFormatter1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.15-stdFmtStockIndexCustomFormatter1/CMakeLists.txt +++ b/05.15-stdFmtStockIndexCustomFormatter1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.15-stdFmtStockIndexCustomFormatter1/main.cpp b/05.15-stdFmtStockIndexCustomFormatter1/main.cpp index 55a0a19..22301a2 100644 --- a/05.15-stdFmtStockIndexCustomFormatter1/main.cpp +++ b/05.15-stdFmtStockIndexCustomFormatter1/main.cpp @@ -1,15 +1,17 @@ // Copyright (c) Andreas Fertig. // SPDX-License-Identifier: MIT -#if __has_include( \ - ) and not defined(__clang__) && not defined(_MSC_VER) +#if __has_include() and not defined(__clang__) # include # include # include # include # include +# include # include +using namespace std::literals; + class StockIndex { std::string mName{}; double mLastPoints{}; @@ -84,30 +86,31 @@ struct std::formatter { return it; } - auto format(const StockIndex& index, format_context& ctx) + auto format(const StockIndex& index, std::format_context& ctx) { if(IndexFormat::Short == indexFormat) { return std::format_to(ctx.out(), - "{:10} {:>8.2f}", + "{:10} {:>8.2f}"sv, index.name(), index.points()); } else { - const std::string fmt{ + const auto fmt{ (IndexFormat::WithPlus == indexFormat) - ? "{:10} {:>8.2f} {: >+7.2f} {:+.2f}%" - : "{:10} {:>8.2f} {:>6.2f} {:.2f}%"}; - - return std::format_to(ctx.out(), - fmt, - index.name(), - index.points(), - index.pointsDiff(), - index.pointsPercent()); + ? "{:10} {:>8.2f} {: >+7.2f} {:+.2f}%"sv + : "{:10} {:>8.2f} {:>6.2f} {:.2f}%"sv}; + + return std::vformat_to( + ctx.out(), + fmt, + std::make_format_args(index.name(), + index.points(), + index.pointsDiff(), + index.pointsPercent())); } } }; -void Use() +int main() { for(const auto& index : GetIndices()) { std::cout << std::format("{}\n", index); @@ -122,11 +125,6 @@ void Use() } } -int main() -{ - Use(); -} - #else int main() { diff --git a/05.17-stdFmtStockIndexCustomFormatter2/CMakeLists.txt b/05.17-stdFmtStockIndexCustomFormatter2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.17-stdFmtStockIndexCustomFormatter2/CMakeLists.txt +++ b/05.17-stdFmtStockIndexCustomFormatter2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.17-stdFmtStockIndexCustomFormatter2/main.cpp b/05.17-stdFmtStockIndexCustomFormatter2/main.cpp index ab2ff3f..5e43431 100644 --- a/05.17-stdFmtStockIndexCustomFormatter2/main.cpp +++ b/05.17-stdFmtStockIndexCustomFormatter2/main.cpp @@ -3,13 +3,13 @@ // use with LC_ALL=de_DE.UTF-8 ./a.out -#if __has_include( \ - ) and not defined(__clang__) && not defined(_MSC_VER) +#if __has_include() and not defined(__clang__) # include # include # include # include # include +# include # include using namespace std::literals; @@ -67,7 +67,7 @@ struct std::formatter { // #A New member to track whether the formatting is localized bool localized = false; - constexpr auto parse(format_parse_context& ctx) + constexpr auto parse(std::format_parse_context& ctx) { auto it = ctx.begin(); @@ -97,7 +97,7 @@ struct std::formatter { return it; } - auto format(const StockIndex& index, format_context& ctx) + auto format(const StockIndex& index, std::format_context& ctx) { // #D Add localized const auto locFloat{localized ? "L"s : ""s}; @@ -106,28 +106,32 @@ struct std::formatter { if(IndexFormat::Short == indexFormat) { const auto fmt = - std::format("{{:10}} {{:>8.2{}f}}", locFloat); - return std::format_to( - ctx.out(), fmt, index.name(), index.points()); + std::format("{{:10}} {{:>8.2{}f}}"sv, locFloat); + + return std::vformat_to( + ctx.out(), + fmt, + std::make_format_args(index.name(), index.points())); } else { const auto fmt{ std::format("{{:10}} {{:>8.2{0}f}} {{:>{1}7.2{0}f}} " - "{{:{1}.2{0}f}}%", + "{{:{1}.2{0}f}}%"sv, locFloat, plus)}; - return std::format_to(ctx.out(), - fmt, - index.name(), - index.points(), - index.pointsDiff(), - index.pointsPercent()); + return std::vformat_to( + ctx.out(), + fmt, + std::make_format_args(index.name(), + index.points(), + index.pointsDiff(), + index.pointsPercent())); } } }; -void Use() +int main() { for(const auto& index : GetIndices()) { std::cout << std::format("{:Ls}\n", index); @@ -138,11 +142,6 @@ void Use() } } -int main() -{ - Use(); -} - #else int main() { diff --git a/05.19-stdFmtFormattingShares0/CMakeLists.txt b/05.19-stdFmtFormattingShares0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.19-stdFmtFormattingShares0/CMakeLists.txt +++ b/05.19-stdFmtFormattingShares0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.19-stdFmtFormattingShares0/main.cpp b/05.19-stdFmtFormattingShares0/main.cpp index 65b7153..a2930ea 100644 --- a/05.19-stdFmtFormattingShares0/main.cpp +++ b/05.19-stdFmtFormattingShares0/main.cpp @@ -56,17 +56,12 @@ void WithStdFormatUseArgumentIndex() } } -void Use() +int main() { WithStdFormat(); WithStdFormatUseArgumentIndex(); } -int main() -{ - Use(); -} - #else int main() { diff --git a/05.21-stdFmtFormatTo0/CMakeLists.txt b/05.21-stdFmtFormatTo0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.21-stdFmtFormatTo0/CMakeLists.txt +++ b/05.21-stdFmtFormatTo0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.21-stdFmtFormatTo0/main.cpp b/05.21-stdFmtFormatTo0/main.cpp index 3553e37..6141b45 100644 --- a/05.21-stdFmtFormatTo0/main.cpp +++ b/05.21-stdFmtFormatTo0/main.cpp @@ -8,7 +8,7 @@ # include # include -void Use() +int main() { std::vector buffer{}; std::format_to( @@ -19,11 +19,6 @@ void Use() std::cout << '\n'; } -int main() -{ - Use(); -} - #else int main() { diff --git a/05.22-stdFmtFormatTo1/CMakeLists.txt b/05.22-stdFmtFormatTo1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.22-stdFmtFormatTo1/CMakeLists.txt +++ b/05.22-stdFmtFormatTo1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.22-stdFmtFormatTo1/main.cpp b/05.22-stdFmtFormatTo1/main.cpp index acf221b..096395e 100644 --- a/05.22-stdFmtFormatTo1/main.cpp +++ b/05.22-stdFmtFormatTo1/main.cpp @@ -8,26 +8,23 @@ # include # include -void Use() +using namespace std::literals; + +int main() { - const std::string fmt{"{}, {}"}; // #A The format string + constexpr auto fmt{"{}, {}"sv}; // #A The format string // #B Lookahead the resulting size in bytes - const auto size = std::formatted_size(fmt, "Hello", "World"); + const auto size = std::formatted_size(fmt, "Hello"sv, "World"sv); std::vector buffer(size); // #C Preallocate the required memory - std::format_to(buffer.begin(), fmt, "Hello", "World"); + std::format_to(buffer.begin(), fmt, "Hello"sv, "World"sv); for(const auto& c : buffer) { std::cout << c; } std::cout << '\n'; } -int main() -{ - Use(); -} - #else int main() { diff --git a/05.23-stdFmtFormatTo2/CMakeLists.txt b/05.23-stdFmtFormatTo2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.23-stdFmtFormatTo2/CMakeLists.txt +++ b/05.23-stdFmtFormatTo2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.23-stdFmtFormatTo2/main.cpp b/05.23-stdFmtFormatTo2/main.cpp index 71bfcda..7b3e1ee 100644 --- a/05.23-stdFmtFormatTo2/main.cpp +++ b/05.23-stdFmtFormatTo2/main.cpp @@ -8,7 +8,7 @@ # include # include -void Use() +int main() { std::vector buffer{'H', 'e', 'l', 'l', 'o', ','}; std::format_to(std::back_inserter(buffer), " {}", "World"); @@ -18,11 +18,6 @@ void Use() std::cout << '\n'; } -int main() -{ - Use(); -} - #else int main() { diff --git a/05.24-stdFmtFormatToN0/CMakeLists.txt b/05.24-stdFmtFormatToN0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.24-stdFmtFormatToN0/CMakeLists.txt +++ b/05.24-stdFmtFormatToN0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.24-stdFmtFormatToN0/main.cpp b/05.24-stdFmtFormatToN0/main.cpp index 53896c1..870853f 100644 --- a/05.24-stdFmtFormatToN0/main.cpp +++ b/05.24-stdFmtFormatToN0/main.cpp @@ -7,7 +7,7 @@ # include # include -void Use() +int main() { std::array buffer{}; std::format_to_n( @@ -16,11 +16,6 @@ void Use() std::cout << buffer.data() << '\n'; } -int main() -{ - Use(); -} - #else int main() { diff --git a/05.25-stdFmtCustomLogger0/CMakeLists.txt b/05.25-stdFmtCustomLogger0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.25-stdFmtCustomLogger0/CMakeLists.txt +++ b/05.25-stdFmtCustomLogger0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.25-stdFmtCustomLogger0/main.cpp b/05.25-stdFmtCustomLogger0/main.cpp index 8ee30d5..b7b0814 100644 --- a/05.25-stdFmtCustomLogger0/main.cpp +++ b/05.25-stdFmtCustomLogger0/main.cpp @@ -7,6 +7,8 @@ # include # include +using namespace std::literals; + enum LogLevel { Info, Warning, Error }; template<> @@ -26,11 +28,12 @@ void log(LogLevel level, std::string_view fmt, const auto&... args) { - std::clog << std::format("{}: ", level) - << std::format(fmt, args...) << '\n'; + std::clog << std::format("{}: "sv, level) + << std::vformat(fmt, std::make_format_args(args...)) + << '\n'; } -void Use() +int main() { int x{4}; std::string share{"Amazon"}; @@ -42,11 +45,6 @@ void Use() log(LogLevel::Error, "Unknown stock, errno {}", errno); } -int main() -{ - Use(); -} - #else int main() { diff --git a/05.27-stdFmtCustomLogger1/CMakeLists.txt b/05.27-stdFmtCustomLogger1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.27-stdFmtCustomLogger1/CMakeLists.txt +++ b/05.27-stdFmtCustomLogger1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.27-stdFmtCustomLogger1/main.cpp b/05.27-stdFmtCustomLogger1/main.cpp index 81a3cc2..3a227d7 100644 --- a/05.27-stdFmtCustomLogger1/main.cpp +++ b/05.27-stdFmtCustomLogger1/main.cpp @@ -36,7 +36,7 @@ log(LogLevel level, std::string_view fmt, const auto&... args) vlog(level, fmt, std::make_format_args(args...)); } -void Use() +int main() { const std::string share{"Amazon"}; const double price{3'117.02}; @@ -50,11 +50,6 @@ void Use() log(LogLevel::Error, "Unknown stock, errno: {}", errno); } -int main() -{ - Use(); -} - #else int main() { diff --git a/05.29-stdFmtCustomLogger2/CMakeLists.txt b/05.29-stdFmtCustomLogger2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.29-stdFmtCustomLogger2/CMakeLists.txt +++ b/05.29-stdFmtCustomLogger2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.29-stdFmtCustomLogger2/main.cpp b/05.29-stdFmtCustomLogger2/main.cpp index 215bf8a..a7f2804 100644 --- a/05.29-stdFmtCustomLogger2/main.cpp +++ b/05.29-stdFmtCustomLogger2/main.cpp @@ -71,7 +71,7 @@ constexpr void log(LogLevel level, const auto&... args) std::make_format_args(args...)); } -void Use() +int main() { const std::string share{"Amazon"}; const double price{3'117.02}; @@ -83,11 +83,6 @@ void Use() log(LogLevel::Error, "Unknown stock, errno:", errno); } -int main() -{ - Use(); -} - #else int main() diff --git a/05.32-stdFmtCustomLogger4/CMakeLists.txt b/05.32-stdFmtCustomLogger4/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/05.32-stdFmtCustomLogger4/CMakeLists.txt +++ b/05.32-stdFmtCustomLogger4/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/05.32-stdFmtCustomLogger4/main.cpp b/05.32-stdFmtCustomLogger4/main.cpp index 539acc9..6aa4258 100644 --- a/05.32-stdFmtCustomLogger4/main.cpp +++ b/05.32-stdFmtCustomLogger4/main.cpp @@ -61,7 +61,7 @@ constexpr void log(LogLevel level, const auto&... args) std::make_format_args(level, args...)); } -void Use() +int main() { int x{4}; std::string share{"Amazon"}; @@ -73,11 +73,6 @@ void Use() log(LogLevel::Error, "Unknown stock, errno", errno); } -int main() -{ - Use(); -} - #else int main() { diff --git a/06.01-equalComparOfMRN0/CMakeLists.txt b/06.01-equalComparOfMRN0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/06.01-equalComparOfMRN0/CMakeLists.txt +++ b/06.01-equalComparOfMRN0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.02-equalComparOfMRN1/CMakeLists.txt b/06.02-equalComparOfMRN1/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/06.02-equalComparOfMRN1/CMakeLists.txt +++ b/06.02-equalComparOfMRN1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.04-equalComparOfMRN2/CMakeLists.txt b/06.04-equalComparOfMRN2/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/06.04-equalComparOfMRN2/CMakeLists.txt +++ b/06.04-equalComparOfMRN2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.05-equalComparOfMRN3/CMakeLists.txt b/06.05-equalComparOfMRN3/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/06.05-equalComparOfMRN3/CMakeLists.txt +++ b/06.05-equalComparOfMRN3/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.06-orderingComparisonString0/CMakeLists.txt b/06.06-orderingComparisonString0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/06.06-orderingComparisonString0/CMakeLists.txt +++ b/06.06-orderingComparisonString0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.07-orderingComparisonString1/CMakeLists.txt b/06.07-orderingComparisonString1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/06.07-orderingComparisonString1/CMakeLists.txt +++ b/06.07-orderingComparisonString1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.08-orderingComparisonString2/CMakeLists.txt b/06.08-orderingComparisonString2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/06.08-orderingComparisonString2/CMakeLists.txt +++ b/06.08-orderingComparisonString2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.09-orderingComparisonString3/CMakeLists.txt b/06.09-orderingComparisonString3/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/06.09-orderingComparisonString3/CMakeLists.txt +++ b/06.09-orderingComparisonString3/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.09-orderingComparisonString3/main.cpp b/06.09-orderingComparisonString3/main.cpp index f3acaf8..1e51f9d 100644 --- a/06.09-orderingComparisonString3/main.cpp +++ b/06.09-orderingComparisonString3/main.cpp @@ -6,7 +6,6 @@ #include #include -#if not defined(__clang__) class String { public: template @@ -48,11 +47,11 @@ std::weak_ordering String::Compare(const String& a, const String& b) return std::weak_ordering::greater; } -# define CMP_PRINT(op, expected) \ - { \ - const bool res = (op); \ - assert(res == expected); \ - } +#define CMP_PRINT(op, expected) \ + { \ + const bool res = (op); \ + assert(res == expected); \ + } int main() { @@ -76,19 +75,4 @@ int main() CMP_PRINT(a > d, true); CMP_PRINT(a > e, false); CMP_PRINT(a < e, true); -} - -#else - -# define CMP_PRINT(op, expected) \ - { \ - const bool res = (op); \ - assert(res == expected); \ - } - -int main() -{ -# pragma message("not supported") -} - -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/06.10-spaceshipResultingType0/CMakeLists.txt b/06.10-spaceshipResultingType0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/06.10-spaceshipResultingType0/CMakeLists.txt +++ b/06.10-spaceshipResultingType0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.11-bcd0/CMakeLists.txt b/06.11-bcd0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/06.11-bcd0/CMakeLists.txt +++ b/06.11-bcd0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.12-bcd1/CMakeLists.txt b/06.12-bcd1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/06.12-bcd1/CMakeLists.txt +++ b/06.12-bcd1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.13-bcdConstexpr/CMakeLists.txt b/06.13-bcdConstexpr/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/06.13-bcdConstexpr/CMakeLists.txt +++ b/06.13-bcdConstexpr/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.14-customOrdering0/CMakeLists.txt b/06.14-customOrdering0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/06.14-customOrdering0/CMakeLists.txt +++ b/06.14-customOrdering0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.15-customOrdering1/CMakeLists.txt b/06.15-customOrdering1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/06.15-customOrdering1/CMakeLists.txt +++ b/06.15-customOrdering1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.16-spaceshipWithLegacyCode0/CMakeLists.txt b/06.16-spaceshipWithLegacyCode0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/06.16-spaceshipWithLegacyCode0/CMakeLists.txt +++ b/06.16-spaceshipWithLegacyCode0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/06.18-spaceshipEqualityRewrite2/CMakeLists.txt b/06.18-spaceshipEqualityRewrite2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/06.18-spaceshipEqualityRewrite2/CMakeLists.txt +++ b/06.18-spaceshipEqualityRewrite2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.01-captureByCopy0/CMakeLists.txt b/07.01-captureByCopy0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/07.01-captureByCopy0/CMakeLists.txt +++ b/07.01-captureByCopy0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.02-captureByCopy1/CMakeLists.txt b/07.02-captureByCopy1/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/07.02-captureByCopy1/CMakeLists.txt +++ b/07.02-captureByCopy1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.03-captureByCopy1Insights/CMakeLists.txt b/07.03-captureByCopy1Insights/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/07.03-captureByCopy1Insights/CMakeLists.txt +++ b/07.03-captureByCopy1Insights/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.04-captureByCopy2/CMakeLists.txt b/07.04-captureByCopy2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/07.04-captureByCopy2/CMakeLists.txt +++ b/07.04-captureByCopy2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.05-mapSortBooksByIsbn0/CMakeLists.txt b/07.05-mapSortBooksByIsbn0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/07.05-mapSortBooksByIsbn0/CMakeLists.txt +++ b/07.05-mapSortBooksByIsbn0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.07-mapSortBooksByIsbn1/CMakeLists.txt b/07.07-mapSortBooksByIsbn1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/07.07-mapSortBooksByIsbn1/CMakeLists.txt +++ b/07.07-mapSortBooksByIsbn1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.08-mapSortBooksByIsbn2/CMakeLists.txt b/07.08-mapSortBooksByIsbn2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/07.08-mapSortBooksByIsbn2/CMakeLists.txt +++ b/07.08-mapSortBooksByIsbn2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.09-mapSortBooksByIsbn3/CMakeLists.txt b/07.09-mapSortBooksByIsbn3/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/07.09-mapSortBooksByIsbn3/CMakeLists.txt +++ b/07.09-mapSortBooksByIsbn3/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.13-mapSortBooksByIsbn4/CMakeLists.txt b/07.13-mapSortBooksByIsbn4/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/07.13-mapSortBooksByIsbn4/CMakeLists.txt +++ b/07.13-mapSortBooksByIsbn4/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.14-printWithOrigin0/CMakeLists.txt b/07.14-printWithOrigin0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/07.14-printWithOrigin0/CMakeLists.txt +++ b/07.14-printWithOrigin0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.15-genericLambdaVarArgsForward0/CMakeLists.txt b/07.15-genericLambdaVarArgsForward0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/07.15-genericLambdaVarArgsForward0/CMakeLists.txt +++ b/07.15-genericLambdaVarArgsForward0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.17-genericLambdaVarArgsForward1/CMakeLists.txt b/07.17-genericLambdaVarArgsForward1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/07.17-genericLambdaVarArgsForward1/CMakeLists.txt +++ b/07.17-genericLambdaVarArgsForward1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.17-genericLambdaVarArgsForward1/main.cpp b/07.17-genericLambdaVarArgsForward1/main.cpp index b9629be..5d1f436 100644 --- a/07.17-genericLambdaVarArgsForward1/main.cpp +++ b/07.17-genericLambdaVarArgsForward1/main.cpp @@ -21,8 +21,7 @@ void print(First&& first, Rest&&... args) auto getNamedLogger(const std::string origin) { - return [=](Ts... args) - { + return [=](Ts... args) { print(origin, std::forward(args)...); }; } diff --git a/07.18-genericLambdaVarArgsForward2/CMakeLists.txt b/07.18-genericLambdaVarArgsForward2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/07.18-genericLambdaVarArgsForward2/CMakeLists.txt +++ b/07.18-genericLambdaVarArgsForward2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.18-genericLambdaVarArgsForward2/main.cpp b/07.18-genericLambdaVarArgsForward2/main.cpp index e2c7d9c..4cc399b 100644 --- a/07.18-genericLambdaVarArgsForward2/main.cpp +++ b/07.18-genericLambdaVarArgsForward2/main.cpp @@ -23,8 +23,7 @@ void print(First&& first, Rest&&... args) template auto getNamedLogger(Origins&&... origins) { - return [=](Ts && ... args) - { + return [=](Ts&&... args) { print(origins..., std::forward(args)...); }; } diff --git a/07.19-lambdaInitCapture0/CMakeLists.txt b/07.19-lambdaInitCapture0/CMakeLists.txt index 89ded8a..df94d21 100644 --- a/07.19-lambdaInitCapture0/CMakeLists.txt +++ b/07.19-lambdaInitCapture0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.20-genericLambdaVarArgsForward3/CMakeLists.txt b/07.20-genericLambdaVarArgsForward3/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/07.20-genericLambdaVarArgsForward3/CMakeLists.txt +++ b/07.20-genericLambdaVarArgsForward3/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.20-genericLambdaVarArgsForward3/main.cpp b/07.20-genericLambdaVarArgsForward3/main.cpp index 0d665e8..c29066b 100644 --- a/07.20-genericLambdaVarArgsForward3/main.cpp +++ b/07.20-genericLambdaVarArgsForward3/main.cpp @@ -27,8 +27,7 @@ auto getNamedLogger(Origins&&... origins) { // #A Create an init-capture of tuple and move origins into it return [tup = std::make_tuple(std::forward( - origins)...)](Ts && ... args) - { + origins)...)](Ts&&... args) { std::apply( // #B A second lambda which is applied to the tuple values [&](const auto&... _origins) { diff --git a/07.21-genericLambdaVarArgsForward4/CMakeLists.txt b/07.21-genericLambdaVarArgsForward4/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/07.21-genericLambdaVarArgsForward4/CMakeLists.txt +++ b/07.21-genericLambdaVarArgsForward4/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.21-genericLambdaVarArgsForward4/main.cpp b/07.21-genericLambdaVarArgsForward4/main.cpp index 75d4047..6c0ccd0 100644 --- a/07.21-genericLambdaVarArgsForward4/main.cpp +++ b/07.21-genericLambdaVarArgsForward4/main.cpp @@ -7,7 +7,6 @@ using namespace std::literals::string_literals; -#if not defined(_MSC_VER) template void print(First&& first, Rest&&... args) { @@ -26,8 +25,7 @@ template auto getNamedLogger(Origins&&... origins) { return [... _origins = std::forward( - origins)](Ts && ... args) - { + origins)](Ts&&... args) { print(_origins..., std::forward(args)...); }; } @@ -39,10 +37,4 @@ int main() auto brakeLogger = getNamedLogger("Brake"s, "Left"s, "Front"s); brakeLogger("force", 40); -} -#else -int main() -{ -# pragma message("not supported") -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/07.23-genericLambdaVarArgsForward5/CMakeLists.txt b/07.23-genericLambdaVarArgsForward5/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/07.23-genericLambdaVarArgsForward5/CMakeLists.txt +++ b/07.23-genericLambdaVarArgsForward5/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.23-genericLambdaVarArgsForward5/main.cpp b/07.23-genericLambdaVarArgsForward5/main.cpp index cd34f4f..f9f8118 100644 --- a/07.23-genericLambdaVarArgsForward5/main.cpp +++ b/07.23-genericLambdaVarArgsForward5/main.cpp @@ -1,11 +1,10 @@ // Copyright (c) Andreas Fertig. // SPDX-License-Identifier: MIT -#if not defined(_MSC_VER) -# include -# include -# include -# include +#include +#include +#include +#include using namespace std::literals::string_literals; @@ -44,8 +43,4 @@ int main() getNamedLogger("Brake"s, "Left"s, "Front"s); steeringLogger("angle"s, 90); -} -#else -# pragma message("not supported") -int main() {} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/07.24-genericLambdaVarArgsForward6/CMakeLists.txt b/07.24-genericLambdaVarArgsForward6/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/07.24-genericLambdaVarArgsForward6/CMakeLists.txt +++ b/07.24-genericLambdaVarArgsForward6/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.24-genericLambdaVarArgsForward6/main.cpp b/07.24-genericLambdaVarArgsForward6/main.cpp index 01889eb..6687d8a 100644 --- a/07.24-genericLambdaVarArgsForward6/main.cpp +++ b/07.24-genericLambdaVarArgsForward6/main.cpp @@ -22,7 +22,6 @@ void print(First&& first, Rest&&... args) std::cout << '\n'; } -#if not defined(_MSC_VER) template auto getNamedLogger(Origins&&... origins) { @@ -46,10 +45,4 @@ int main() auto brakeLogger = getNamedLogger("Brake"s, "Left"s, "Front"s); steeringLogger("angle"s, 90); -} -#else -int main() -{ /*keep*/ -# pragma message("not supported") -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/07.25-genericLambdaVarArgsForward7/CMakeLists.txt b/07.25-genericLambdaVarArgsForward7/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/07.25-genericLambdaVarArgsForward7/CMakeLists.txt +++ b/07.25-genericLambdaVarArgsForward7/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/07.25-genericLambdaVarArgsForward7/main.cpp b/07.25-genericLambdaVarArgsForward7/main.cpp index f0a56ba..350b38a 100644 --- a/07.25-genericLambdaVarArgsForward7/main.cpp +++ b/07.25-genericLambdaVarArgsForward7/main.cpp @@ -20,7 +20,6 @@ void print(First&& first, Rest&&... args) std::cout << '\n'; } -#if not defined(_MSC_VER) template concept NotFloatingPoint = not std::is_floating_point_v; @@ -42,8 +41,4 @@ int main() auto brakeLogger = getNamedLogger("Brake"s, "Left"s, "Front"s); steeringLogger("angle"s, 90); -} -#else -# pragma message("not supported") -int main() {} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/08.01-aggregateInit0/CMakeLists.txt b/08.01-aggregateInit0/CMakeLists.txt index c24e024..14b1ad9 100644 --- a/08.01-aggregateInit0/CMakeLists.txt +++ b/08.01-aggregateInit0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.02-userProvidedVsDeclared0/CMakeLists.txt b/08.02-userProvidedVsDeclared0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/08.02-userProvidedVsDeclared0/CMakeLists.txt +++ b/08.02-userProvidedVsDeclared0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.03-designatedInitializers0/CMakeLists.txt b/08.03-designatedInitializers0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/08.03-designatedInitializers0/CMakeLists.txt +++ b/08.03-designatedInitializers0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.04-designatedInitializers1/CMakeLists.txt b/08.04-designatedInitializers1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/08.04-designatedInitializers1/CMakeLists.txt +++ b/08.04-designatedInitializers1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.05-mostVertexingParse0/CMakeLists.txt b/08.05-mostVertexingParse0/CMakeLists.txt index bdc26d6..6b6ab12 100644 --- a/08.05-mostVertexingParse0/CMakeLists.txt +++ b/08.05-mostVertexingParse0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.06-designatedInitializers2/CMakeLists.txt b/08.06-designatedInitializers2/CMakeLists.txt index 05664f2..134ea0d 100644 --- a/08.06-designatedInitializers2/CMakeLists.txt +++ b/08.06-designatedInitializers2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.07-designatedInitializers3/CMakeLists.txt b/08.07-designatedInitializers3/CMakeLists.txt index 04cd772..d1c753e 100644 --- a/08.07-designatedInitializers3/CMakeLists.txt +++ b/08.07-designatedInitializers3/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.09-designatedInitializers4/CMakeLists.txt b/08.09-designatedInitializers4/CMakeLists.txt index 5ec600a..a23742e 100644 --- a/08.09-designatedInitializers4/CMakeLists.txt +++ b/08.09-designatedInitializers4/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.10-guaranteedCopyElision0/CMakeLists.txt b/08.10-guaranteedCopyElision0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/08.10-guaranteedCopyElision0/CMakeLists.txt +++ b/08.10-guaranteedCopyElision0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.10-guaranteedCopyElision0/main.cpp b/08.10-guaranteedCopyElision0/main.cpp index cb44496..68d568d 100644 --- a/08.10-guaranteedCopyElision0/main.cpp +++ b/08.10-guaranteedCopyElision0/main.cpp @@ -21,13 +21,8 @@ NonCopyableOrMoveable RVO() return {}; // #B This is where RVO happens } -void Use() +int main() { // #C The return-object is created directly at myValue auto myValue = RVO(); -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/08.11-designatedInitializers5/CMakeLists.txt b/08.11-designatedInitializers5/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/08.11-designatedInitializers5/CMakeLists.txt +++ b/08.11-designatedInitializers5/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.13-designatedInitializersAndFunctionParameters0/CMakeLists.txt b/08.13-designatedInitializersAndFunctionParameters0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/08.13-designatedInitializersAndFunctionParameters0/CMakeLists.txt +++ b/08.13-designatedInitializersAndFunctionParameters0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.13-designatedInitializersAndFunctionParameters0/main.cpp b/08.13-designatedInitializersAndFunctionParameters0/main.cpp index 7cb441a..6215e31 100644 --- a/08.13-designatedInitializersAndFunctionParameters0/main.cpp +++ b/08.13-designatedInitializersAndFunctionParameters0/main.cpp @@ -3,11 +3,6 @@ void FileAccess(bool open, bool close, bool readonly); -void Use() -{ - FileAccess(true, false, true); -} - void FileAccess(bool open, bool close, bool readonly) {} void LLVM() @@ -17,7 +12,7 @@ void LLVM() int main() { - Use(); + FileAccess(true, false, true); LLVM(); } \ No newline at end of file diff --git a/08.15-designatedInitializersAndFunctionParameters1/CMakeLists.txt b/08.15-designatedInitializersAndFunctionParameters1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/08.15-designatedInitializersAndFunctionParameters1/CMakeLists.txt +++ b/08.15-designatedInitializersAndFunctionParameters1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.15-designatedInitializersAndFunctionParameters1/main.cpp b/08.15-designatedInitializersAndFunctionParameters1/main.cpp index 37e1b0f..47aee6c 100644 --- a/08.15-designatedInitializersAndFunctionParameters1/main.cpp +++ b/08.15-designatedInitializersAndFunctionParameters1/main.cpp @@ -11,12 +11,7 @@ void FileAccess(const FileAccessParameters& params); void FileAccess(const FileAccessParameters& params) {} -void Use() -{ - FileAccess({.open = true, .close = false, .readonly = true}); -} - int main() { - Use(); + FileAccess({.open = true, .close = false, .readonly = true}); } \ No newline at end of file diff --git a/08.17-designatedInitializersOverloadResolution0/CMakeLists.txt b/08.17-designatedInitializersOverloadResolution0/CMakeLists.txt index 5ec600a..a23742e 100644 --- a/08.17-designatedInitializersOverloadResolution0/CMakeLists.txt +++ b/08.17-designatedInitializersOverloadResolution0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.17-designatedInitializersOverloadResolution0/main.cpp b/08.17-designatedInitializersOverloadResolution0/main.cpp index 846245d..b3910a3 100644 --- a/08.17-designatedInitializersOverloadResolution0/main.cpp +++ b/08.17-designatedInitializersOverloadResolution0/main.cpp @@ -18,15 +18,6 @@ struct Point2D { void Add(const Point& p, int v); void Add(const Point2D& p, int v); -void Use() -{ - Add({.X = 3, .y = 4}, 3); // #C Fine, selects Point2D - Add({.y = 4, .x = 3}, 3); // #D Fine, selects Point - - // #E Will not compile as soley .y is ambiguous - // Add({.y = 4}, 3); -} - void Add(const Point& p, int v) { printf("Point\n"); @@ -39,5 +30,9 @@ void Add(const Point2D& p, int v) int main() { - Use(); + Add({.X = 3, .y = 4}, 3); // #C Fine, selects Point2D + Add({.y = 4, .x = 3}, 3); // #D Fine, selects Point + + // #E Will not compile as soley .y is ambiguous + // Add({.y = 4}, 3); } \ No newline at end of file diff --git a/08.18-bracedInitVsParensWithStdVector0/CMakeLists.txt b/08.18-bracedInitVsParensWithStdVector0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/08.18-bracedInitVsParensWithStdVector0/CMakeLists.txt +++ b/08.18-bracedInitVsParensWithStdVector0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.19-makeUniqueWithAnAggregate0/CMakeLists.txt b/08.19-makeUniqueWithAnAggregate0/CMakeLists.txt index 52469df..796c1c2 100644 --- a/08.19-makeUniqueWithAnAggregate0/CMakeLists.txt +++ b/08.19-makeUniqueWithAnAggregate0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.19-makeUniqueWithAnAggregate0/main.cpp b/08.19-makeUniqueWithAnAggregate0/main.cpp index 17149b1..16c1229 100644 --- a/08.19-makeUniqueWithAnAggregate0/main.cpp +++ b/08.19-makeUniqueWithAnAggregate0/main.cpp @@ -12,16 +12,11 @@ struct Point { int z; }; -void Use() -{ - auto pt = std::make_unique(4, 5); -} - const auto* pt = new Point(4, 5); int main() { - Use(); + auto pt = std::make_unique(4, 5); } #else int main() diff --git a/08.21-initializationForms0/CMakeLists.txt b/08.21-initializationForms0/CMakeLists.txt index 254ad3f..1dc0d59 100644 --- a/08.21-initializationForms0/CMakeLists.txt +++ b/08.21-initializationForms0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.22-aggregateWithUserDeclaredConstructor0/CMakeLists.txt b/08.22-aggregateWithUserDeclaredConstructor0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/08.22-aggregateWithUserDeclaredConstructor0/CMakeLists.txt +++ b/08.22-aggregateWithUserDeclaredConstructor0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.25-ctad0/CMakeLists.txt b/08.25-ctad0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/08.25-ctad0/CMakeLists.txt +++ b/08.25-ctad0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.26-structuredBindingsPOSIXError0/CMakeLists.txt b/08.26-structuredBindingsPOSIXError0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/08.26-structuredBindingsPOSIXError0/CMakeLists.txt +++ b/08.26-structuredBindingsPOSIXError0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.27-structuredBindingsPOSIXError1/CMakeLists.txt b/08.27-structuredBindingsPOSIXError1/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/08.27-structuredBindingsPOSIXError1/CMakeLists.txt +++ b/08.27-structuredBindingsPOSIXError1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.28-structuredBindingsPOSIXError2/CMakeLists.txt b/08.28-structuredBindingsPOSIXError2/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/08.28-structuredBindingsPOSIXError2/CMakeLists.txt +++ b/08.28-structuredBindingsPOSIXError2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.29-structuredBindingsPOSIXError3/CMakeLists.txt b/08.29-structuredBindingsPOSIXError3/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/08.29-structuredBindingsPOSIXError3/CMakeLists.txt +++ b/08.29-structuredBindingsPOSIXError3/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/08.30-structuredBindingsPOSIXError4/CMakeLists.txt b/08.30-structuredBindingsPOSIXError4/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/08.30-structuredBindingsPOSIXError4/CMakeLists.txt +++ b/08.30-structuredBindingsPOSIXError4/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/09.01-stdArray0/CMakeLists.txt b/09.01-stdArray0/CMakeLists.txt index 2f2d123..9566747 100644 --- a/09.01-stdArray0/CMakeLists.txt +++ b/09.01-stdArray0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/09.02-floatingPointNTTP0/CMakeLists.txt b/09.02-floatingPointNTTP0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/09.02-floatingPointNTTP0/CMakeLists.txt +++ b/09.02-floatingPointNTTP0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/09.03-fixedString0/CMakeLists.txt b/09.03-fixedString0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/09.03-fixedString0/CMakeLists.txt +++ b/09.03-fixedString0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/09.04-fixedString1/CMakeLists.txt b/09.04-fixedString1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/09.04-fixedString1/CMakeLists.txt +++ b/09.04-fixedString1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/09.04-fixedString1/main.cpp b/09.04-fixedString1/main.cpp index 9df9276..ab92d3c 100644 --- a/09.04-fixedString1/main.cpp +++ b/09.04-fixedString1/main.cpp @@ -6,6 +6,7 @@ #include #include +#if not defined(__clang__) template struct fixed_string { CharT data[N]{}; @@ -16,7 +17,6 @@ struct fixed_string { } }; -#if __has_include() and not defined(__clang__) template // #A Here we have a NTTP struct FixedStringContainer { void print() @@ -25,14 +25,6 @@ struct FixedStringContainer { } }; -void Use() -{ - // #C We can instantiate the template with a string - FixedStringContainer<"Hello, C++"> fc{}; - fc.print(); // #D For those who believe it only if they see - // it -} - template // #A Takes the fixed string as NTTP struct FormatString { // #B Store the string for easy access @@ -64,6 +56,11 @@ int main() print(FormatString<"%s, %s">{}, "Hello", "C++20"); print("%s, %s"_fs, "Hello", "C++20"); + + // #C We can instantiate the template with a string + FixedStringContainer<"Hello, C++"> fc{}; + fc.print(); // #D For those who believe it only if they see + // it } #else int main() diff --git a/09.12-fixedString2/CMakeLists.txt b/09.12-fixedString2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/09.12-fixedString2/CMakeLists.txt +++ b/09.12-fixedString2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/09.12-fixedString2/main.cpp b/09.12-fixedString2/main.cpp index 5fcffa0..0ed0bb6 100644 --- a/09.12-fixedString2/main.cpp +++ b/09.12-fixedString2/main.cpp @@ -45,18 +45,13 @@ void print(auto fmt, const auto&... args) printf(fmt, args...); } -void Use() -{ - print(FormatString<"%s, %s">{}, "Hello", "C++20"); - - print("%s, %s"_fs, "Hello", "C++20"); -} - int main() { fixed_string fs{"Hello, C++20"}; - Use(); + print(FormatString<"%s, %s">{}, "Hello", "C++20"); + + print("%s, %s"_fs, "Hello", "C++20"); } #else int main() diff --git a/09.13-fixedString3/CMakeLists.txt b/09.13-fixedString3/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/09.13-fixedString3/CMakeLists.txt +++ b/09.13-fixedString3/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/09.13-fixedString3/main.cpp b/09.13-fixedString3/main.cpp index f54ad56..500756e 100644 --- a/09.13-fixedString3/main.cpp +++ b/09.13-fixedString3/main.cpp @@ -7,8 +7,7 @@ #include #include -#if not defined(_MSC_VER) && \ - __has_include() and not defined(__clang__) +#if __has_include() and not defined(__clang__) template struct fixed_string { diff --git a/10.01-bitCastFloatToInt0/CMakeLists.txt b/10.01-bitCastFloatToInt0/CMakeLists.txt index 3a8bd9b..a5353cc 100644 --- a/10.01-bitCastFloatToInt0/CMakeLists.txt +++ b/10.01-bitCastFloatToInt0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.01-bitCastFloatToInt0/main.cpp b/10.01-bitCastFloatToInt0/main.cpp index 110409e..507b425 100644 --- a/10.01-bitCastFloatToInt0/main.cpp +++ b/10.01-bitCastFloatToInt0/main.cpp @@ -12,7 +12,7 @@ int main() uint32_t a = static_cast(pi); // #A Does not do what we want // uint32_t b = reinterpret_cast(pi); // #B Does not compile - // #C Uses type-punning, can result in UB + // #C Uses type-punning, can result in UB uint32_t c = *reinterpret_cast(&pi); union FloatOrInt { diff --git a/10.02-bitCastFloatToInt1/CMakeLists.txt b/10.02-bitCastFloatToInt1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/10.02-bitCastFloatToInt1/CMakeLists.txt +++ b/10.02-bitCastFloatToInt1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.03-byteSwap0/CMakeLists.txt b/10.03-byteSwap0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/10.03-byteSwap0/CMakeLists.txt +++ b/10.03-byteSwap0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.04-stdArrayVsCArray0/CMakeLists.txt b/10.04-stdArrayVsCArray0/CMakeLists.txt index 2f2d123..9566747 100644 --- a/10.04-stdArrayVsCArray0/CMakeLists.txt +++ b/10.04-stdArrayVsCArray0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.05-stdArrayVsCArray1/CMakeLists.txt b/10.05-stdArrayVsCArray1/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/10.05-stdArrayVsCArray1/CMakeLists.txt +++ b/10.05-stdArrayVsCArray1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.06-stdArrayVsCArray2/CMakeLists.txt b/10.06-stdArrayVsCArray2/CMakeLists.txt index 04cd772..d1c753e 100644 --- a/10.06-stdArrayVsCArray2/CMakeLists.txt +++ b/10.06-stdArrayVsCArray2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.07-lengthAndValue0/CMakeLists.txt b/10.07-lengthAndValue0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/10.07-lengthAndValue0/CMakeLists.txt +++ b/10.07-lengthAndValue0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.07-lengthAndValue0/main.cpp b/10.07-lengthAndValue0/main.cpp index b9f04d4..2c52889 100644 --- a/10.07-lengthAndValue0/main.cpp +++ b/10.07-lengthAndValue0/main.cpp @@ -11,21 +11,6 @@ bool write(const char*, size_t) bool Send(const char* data, size_t size); void Read(char* data, size_t size); -void Use() -{ - char buffer[1'024]{}; - - Read(buffer, sizeof(buffer)); - Send(buffer, sizeof(buffer)); - - // some code in-between - - char buffer2[2'048]{}; - - Read(buffer, sizeof(buffer2)); - Send(buffer, sizeof(buffer2)); -} - bool Send(const char* data, size_t size) { if(!data) { return false; } @@ -42,5 +27,15 @@ void Read(char* data, size_t size) int main() { - Use(); + char buffer[1'024]{}; + + Read(buffer, sizeof(buffer)); + Send(buffer, sizeof(buffer)); + + // some code in-between + + char buffer2[2'048]{}; + + Read(buffer, sizeof(buffer2)); + Send(buffer, sizeof(buffer2)); } \ No newline at end of file diff --git a/10.08-lengthAndValue1/CMakeLists.txt b/10.08-lengthAndValue1/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/10.08-lengthAndValue1/CMakeLists.txt +++ b/10.08-lengthAndValue1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.08-lengthAndValue1/main.cpp b/10.08-lengthAndValue1/main.cpp index 17fea31..c0b5814 100644 --- a/10.08-lengthAndValue1/main.cpp +++ b/10.08-lengthAndValue1/main.cpp @@ -15,21 +15,6 @@ bool Send(const std::array& data); template void Read(std::array& data); -void Use() -{ - std::array buffer{}; - - Read(buffer); - Send(buffer); - - // some code in-between - - std::array buffer2{}; - - Read(buffer2); - Send(buffer2); -} - template bool Send(const std::array& data) { @@ -44,5 +29,15 @@ void Read(std::array& data) int main() { - Use(); + std::array buffer{}; + + Read(buffer); + Send(buffer); + + // some code in-between + + std::array buffer2{}; + + Read(buffer2); + Send(buffer2); } \ No newline at end of file diff --git a/10.09-lengthAndValue2/CMakeLists.txt b/10.09-lengthAndValue2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/10.09-lengthAndValue2/CMakeLists.txt +++ b/10.09-lengthAndValue2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.09-lengthAndValue2/main.cpp b/10.09-lengthAndValue2/main.cpp index 4ab614c..a13c018 100644 --- a/10.09-lengthAndValue2/main.cpp +++ b/10.09-lengthAndValue2/main.cpp @@ -13,21 +13,6 @@ bool write(const char*, size_t) bool Send(std::span data); void Read(std::span data); -void Use() -{ - std::array buffer{}; - - Read(buffer); - Send(buffer); - - // some code in-between - - char buffer2[2'048]{}; - - Read(buffer2); - Send(buffer2); -} - bool Send(std::span data) { return write(data.data(), data.size()); @@ -40,5 +25,15 @@ void Read(std::span data) int main() { - Use(); + std::array buffer{}; + + Read(buffer); + Send(buffer); + + // some code in-between + + char buffer2[2'048]{}; + + Read(buffer2); + Send(buffer2); } \ No newline at end of file diff --git a/10.10-span0/CMakeLists.txt b/10.10-span0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/10.10-span0/CMakeLists.txt +++ b/10.10-span0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.11-assert0/CMakeLists.txt b/10.11-assert0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/10.11-assert0/CMakeLists.txt +++ b/10.11-assert0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.11-assert0/main.cpp b/10.11-assert0/main.cpp index b052cbd..5b252f6 100644 --- a/10.11-assert0/main.cpp +++ b/10.11-assert0/main.cpp @@ -27,12 +27,7 @@ void Assert(bool condition, __LINE__) // #E Get function and line information from // caller -void Use() -{ - ASSERT(1 != 2, "Not met"); -} - int main() { - Use(); + ASSERT(1 != 2, "Not met"); } \ No newline at end of file diff --git a/10.13-assert1/CMakeLists.txt b/10.13-assert1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/10.13-assert1/CMakeLists.txt +++ b/10.13-assert1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.13-assert1/main.cpp b/10.13-assert1/main.cpp index 6de619b..68ad5be 100644 --- a/10.13-assert1/main.cpp +++ b/10.13-assert1/main.cpp @@ -20,16 +20,11 @@ void Assert(bool condition, } } -void Use() +int main() { // #C A call to Assert with information of Use Assert(1 != 2, "Not met"); } - -int main() -{ - Use(); -} #else int main() { diff --git a/10.14-logFunction0/CMakeLists.txt b/10.14-logFunction0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/10.14-logFunction0/CMakeLists.txt +++ b/10.14-logFunction0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.15-logFunction1/CMakeLists.txt b/10.15-logFunction1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/10.15-logFunction1/CMakeLists.txt +++ b/10.15-logFunction1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.16-logFunction2/CMakeLists.txt b/10.16-logFunction2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/10.16-logFunction2/CMakeLists.txt +++ b/10.16-logFunction2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.17-mapContains0/CMakeLists.txt b/10.17-mapContains0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/10.17-mapContains0/CMakeLists.txt +++ b/10.17-mapContains0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.18-mapContains1/CMakeLists.txt b/10.18-mapContains1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/10.18-mapContains1/CMakeLists.txt +++ b/10.18-mapContains1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.19-startsWith0/CMakeLists.txt b/10.19-startsWith0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/10.19-startsWith0/CMakeLists.txt +++ b/10.19-startsWith0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/10.20-startsWith1/CMakeLists.txt b/10.20-startsWith1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/10.20-startsWith1/CMakeLists.txt +++ b/10.20-startsWith1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.01-rangeBaseForWithInit0/CMakeLists.txt b/11.01-rangeBaseForWithInit0/CMakeLists.txt index 2f2d123..9566747 100644 --- a/11.01-rangeBaseForWithInit0/CMakeLists.txt +++ b/11.01-rangeBaseForWithInit0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.02-rangeBaseForWithInit1/CMakeLists.txt b/11.02-rangeBaseForWithInit1/CMakeLists.txt index 2f2d123..9566747 100644 --- a/11.02-rangeBaseForWithInit1/CMakeLists.txt +++ b/11.02-rangeBaseForWithInit1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.03-rangeBaseForWithInit2/CMakeLists.txt b/11.03-rangeBaseForWithInit2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/11.03-rangeBaseForWithInit2/CMakeLists.txt +++ b/11.03-rangeBaseForWithInit2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.04-rangeBasedForLoopWithTemporary0/CMakeLists.txt b/11.04-rangeBasedForLoopWithTemporary0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/11.04-rangeBasedForLoopWithTemporary0/CMakeLists.txt +++ b/11.04-rangeBasedForLoopWithTemporary0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.04-rangeBasedForLoopWithTemporary0/main.cpp b/11.04-rangeBasedForLoopWithTemporary0/main.cpp index f8792e0..4dcf77e 100644 --- a/11.04-rangeBasedForLoopWithTemporary0/main.cpp +++ b/11.04-rangeBasedForLoopWithTemporary0/main.cpp @@ -19,15 +19,10 @@ Keeper GetKeeper() // #C Returns by value return {}; } -void Use() +int main() { // #D Use the result of GetKeeper and return over items for(auto& item : GetKeeper().items()) { std::cout << item << '\n'; } -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/11.05-rangeBasedForLoopWithTemporary1/CMakeLists.txt b/11.05-rangeBasedForLoopWithTemporary1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/11.05-rangeBasedForLoopWithTemporary1/CMakeLists.txt +++ b/11.05-rangeBasedForLoopWithTemporary1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.05-rangeBasedForLoopWithTemporary1/main.cpp b/11.05-rangeBasedForLoopWithTemporary1/main.cpp index b457904..d9f1355 100644 --- a/11.05-rangeBasedForLoopWithTemporary1/main.cpp +++ b/11.05-rangeBasedForLoopWithTemporary1/main.cpp @@ -18,14 +18,9 @@ Keeper GetKeeper() return {}; } -void Use() +int main() { for(auto&& items = GetKeeper(); auto& item : items.items()) { std::cout << item << '\n'; } -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/11.06-likely0/CMakeLists.txt b/11.06-likely0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/11.06-likely0/CMakeLists.txt +++ b/11.06-likely0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.07-likely1/CMakeLists.txt b/11.07-likely1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/11.07-likely1/CMakeLists.txt +++ b/11.07-likely1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.08-notCopyable0/CMakeLists.txt b/11.08-notCopyable0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/11.08-notCopyable0/CMakeLists.txt +++ b/11.08-notCopyable0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.09-notCopyable1/CMakeLists.txt b/11.09-notCopyable1/CMakeLists.txt index 17bb3a9..4d5f8f8 100644 --- a/11.09-notCopyable1/CMakeLists.txt +++ b/11.09-notCopyable1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.10-usingEnum0/CMakeLists.txt b/11.10-usingEnum0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/11.10-usingEnum0/CMakeLists.txt +++ b/11.10-usingEnum0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.11-usingEnum1/CMakeLists.txt b/11.11-usingEnum1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/11.11-usingEnum1/CMakeLists.txt +++ b/11.11-usingEnum1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.12-conditionalExplicit0/CMakeLists.txt b/11.12-conditionalExplicit0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/11.12-conditionalExplicit0/CMakeLists.txt +++ b/11.12-conditionalExplicit0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.12-conditionalExplicit0/main.cpp b/11.12-conditionalExplicit0/main.cpp index 9591fae..b89edb6 100644 --- a/11.12-conditionalExplicit0/main.cpp +++ b/11.12-conditionalExplicit0/main.cpp @@ -11,12 +11,6 @@ struct A { void Fun(A a); -void Use() -{ - Fun(A{}); - // Fun(B{}); // #B Will not compile due to explicit ctor -} - void Fun(A a) {} A::A(const B&) {} @@ -27,5 +21,6 @@ A::operator B() const int main() { - Use(); + Fun(A{}); + // Fun(B{}); // #B Will not compile due to explicit ctor } \ No newline at end of file diff --git a/11.13-conditionalExplicit1/CMakeLists.txt b/11.13-conditionalExplicit1/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/11.13-conditionalExplicit1/CMakeLists.txt +++ b/11.13-conditionalExplicit1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.13-conditionalExplicit1/main.cpp b/11.13-conditionalExplicit1/main.cpp index 1ad9548..ad40269 100644 --- a/11.13-conditionalExplicit1/main.cpp +++ b/11.13-conditionalExplicit1/main.cpp @@ -17,12 +17,6 @@ struct Wrapper { void Fun(Wrapper a); // #A Takes Wrapper now -void Use() -{ - Fun(A{}); - Fun(B{}); // #B Does compile! -} - template template Wrapper::Wrapper(const U&) @@ -32,5 +26,6 @@ void Fun(Wrapper a) {} int main() { - Use(); + Fun(A{}); + Fun(B{}); // #B Does compile! } \ No newline at end of file diff --git a/11.14-conditionalExplicit2/CMakeLists.txt b/11.14-conditionalExplicit2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/11.14-conditionalExplicit2/CMakeLists.txt +++ b/11.14-conditionalExplicit2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/11.15-conditionalExplicit5/CMakeLists.txt b/11.15-conditionalExplicit5/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/11.15-conditionalExplicit5/CMakeLists.txt +++ b/11.15-conditionalExplicit5/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.01-constexprStrlenCpp110/CMakeLists.txt b/12.01-constexprStrlenCpp110/CMakeLists.txt index 2f2d123..9566747 100644 --- a/12.01-constexprStrlenCpp110/CMakeLists.txt +++ b/12.01-constexprStrlenCpp110/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.02-constexprStrlenCpp111/CMakeLists.txt b/12.02-constexprStrlenCpp111/CMakeLists.txt index 2f2d123..9566747 100644 --- a/12.02-constexprStrlenCpp111/CMakeLists.txt +++ b/12.02-constexprStrlenCpp111/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.03-constexprPoint0/CMakeLists.txt b/12.03-constexprPoint0/CMakeLists.txt index c24e024..14b1ad9 100644 --- a/12.03-constexprPoint0/CMakeLists.txt +++ b/12.03-constexprPoint0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.03-constexprPoint0/main.cpp b/12.03-constexprPoint0/main.cpp index 5364b05..8d42f0d 100644 --- a/12.03-constexprPoint0/main.cpp +++ b/12.03-constexprPoint0/main.cpp @@ -33,14 +33,9 @@ constexpr Point move(Point p, double x, double y) return p; } -void Use() +int main() { constexpr Point p = move({2, 2}, 3, 2); printf("x:%lf y:%lf\n", p.GetX(), p.GetY()); -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/12.04-constexprThrow0/CMakeLists.txt b/12.04-constexprThrow0/CMakeLists.txt index c24e024..14b1ad9 100644 --- a/12.04-constexprThrow0/CMakeLists.txt +++ b/12.04-constexprThrow0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.05-throwAtCompileTime0/CMakeLists.txt b/12.05-throwAtCompileTime0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/12.05-throwAtCompileTime0/CMakeLists.txt +++ b/12.05-throwAtCompileTime0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.06-logStatementInConstexpr0/CMakeLists.txt b/12.06-logStatementInConstexpr0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/12.06-logStatementInConstexpr0/CMakeLists.txt +++ b/12.06-logStatementInConstexpr0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.08-byteSwap1/CMakeLists.txt b/12.08-byteSwap1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/12.08-byteSwap1/CMakeLists.txt +++ b/12.08-byteSwap1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.09-constantEvalutedAndConstexprIf0/CMakeLists.txt b/12.09-constantEvalutedAndConstexprIf0/CMakeLists.txt index 542eb10..2d1f52d 100644 --- a/12.09-constantEvalutedAndConstexprIf0/CMakeLists.txt +++ b/12.09-constantEvalutedAndConstexprIf0/CMakeLists.txt @@ -58,14 +58,14 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and # enables more conformant C++ in general add_definitions(/permissive-) - + add_definitions(/wd5063) + else() add_definitions(-DIS_MSVC=false) add_definitions(-Werror) diff --git a/12.10-constexprAllocation0/CMakeLists.txt b/12.10-constexprAllocation0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/12.10-constexprAllocation0/CMakeLists.txt +++ b/12.10-constexprAllocation0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.10-constexprAllocation0/main.cpp b/12.10-constexprAllocation0/main.cpp index 5103368..021485a 100644 --- a/12.10-constexprAllocation0/main.cpp +++ b/12.10-constexprAllocation0/main.cpp @@ -21,9 +21,9 @@ struct Tesla : Car { Car* CreateCar(int i) { switch(i) { - case 0: return new Mercedes{}; break; - case 1: return new Toyota{}; break; - case 2: return new Tesla{}; break; + case 0: return new Mercedes{}; + case 1: return new Toyota{}; + case 2: return new Tesla{}; } return nullptr; @@ -47,14 +47,9 @@ int FastestCar() return maxId; } -void Use() +int main() { auto* c = CreateCar(1); auto f = FastestCar(); -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/12.12-constexprAllocation1/CMakeLists.txt b/12.12-constexprAllocation1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/12.12-constexprAllocation1/CMakeLists.txt +++ b/12.12-constexprAllocation1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.12-constexprAllocation1/main.cpp b/12.12-constexprAllocation1/main.cpp index ed3df07..8526283 100644 --- a/12.12-constexprAllocation1/main.cpp +++ b/12.12-constexprAllocation1/main.cpp @@ -23,9 +23,9 @@ struct Tesla : Car { constexpr Car* CreateCar(int i) { switch(i) { - case 0: return new Mercedes{}; break; - case 1: return new Toyota{}; break; - case 2: return new Tesla{}; break; + case 0: return new Mercedes{}; + case 1: return new Toyota{}; + case 2: return new Tesla{}; } return nullptr; @@ -49,7 +49,7 @@ constexpr int FastestCar() return maxId; } -void Use() +int main() { auto* c = CreateCar(1); @@ -57,11 +57,6 @@ void Use() static_assert(f == 2); } - -int main() -{ - Use(); -} #else int main() { diff --git a/12.14-constexprAllocation2/CMakeLists.txt b/12.14-constexprAllocation2/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/12.14-constexprAllocation2/CMakeLists.txt +++ b/12.14-constexprAllocation2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.14-constexprAllocation2/main.cpp b/12.14-constexprAllocation2/main.cpp index 5fa0761..5151cde 100644 --- a/12.14-constexprAllocation2/main.cpp +++ b/12.14-constexprAllocation2/main.cpp @@ -36,9 +36,9 @@ struct Tesla : Car { constexpr unique_ptr CreateCar(int i) { switch(i) { - case 0: return new Mercedes{}; break; - case 1: return new Toyota{}; break; - case 2: return new Tesla{}; break; + case 0: return new Mercedes{}; + case 1: return new Toyota{}; + case 2: return new Tesla{}; } return nullptr; diff --git a/12.15-asConstant0/CMakeLists.txt b/12.15-asConstant0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/12.15-asConstant0/CMakeLists.txt +++ b/12.15-asConstant0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.15-asConstant0/main.cpp b/12.15-asConstant0/main.cpp index 1ed06a6..16e091c 100644 --- a/12.15-asConstant0/main.cpp +++ b/12.15-asConstant0/main.cpp @@ -6,15 +6,10 @@ constexpr int ExpensiveCalculation(int base) return base + 1; // Well, ... expensive } -void Use() +int main() { auto value1 = ExpensiveCalculation(2); // #A run-time constexpr auto value2 = ExpensiveCalculation(2); // #B compile-time //++value2; // #C Doesn't compile, value2 is const -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/12.16-asConstant1/CMakeLists.txt b/12.16-asConstant1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/12.16-asConstant1/CMakeLists.txt +++ b/12.16-asConstant1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.16-asConstant1/main.cpp b/12.16-asConstant1/main.cpp index d3fd151..04e3d54 100644 --- a/12.16-asConstant1/main.cpp +++ b/12.16-asConstant1/main.cpp @@ -11,14 +11,9 @@ constexpr int ExpensiveCalculation(int base) return base + 1; // Well, ... expensive } -void Use() +int main() { auto value2 = as_constant(ExpensiveCalculation(2)); // #B compile-time ++value2; // #C Compiles -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/12.18-constevalParmCheck0/CMakeLists.txt b/12.18-constevalParmCheck0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/12.18-constevalParmCheck0/CMakeLists.txt +++ b/12.18-constevalParmCheck0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.18-constevalParmCheck0/main.cpp b/12.18-constevalParmCheck0/main.cpp index 8225099..ed7f894 100644 --- a/12.18-constevalParmCheck0/main.cpp +++ b/12.18-constevalParmCheck0/main.cpp @@ -70,14 +70,9 @@ string format(std::string_view fmt, const Args&... args) return out; } -void Use() +int main() { auto str = format("ds", 12457, " hello"); printf("'%s'", str.data()); -} - -int main() -{ - Use(); } \ No newline at end of file diff --git a/12.19-constevalParmCheck1/CMakeLists.txt b/12.19-constevalParmCheck1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/12.19-constevalParmCheck1/CMakeLists.txt +++ b/12.19-constevalParmCheck1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.19-constevalParmCheck1/main.cpp b/12.19-constevalParmCheck1/main.cpp index f931e11..f512ddc 100644 --- a/12.19-constevalParmCheck1/main.cpp +++ b/12.19-constevalParmCheck1/main.cpp @@ -2,13 +2,13 @@ // SPDX-License-Identifier: MIT #include +#include #include #include #include -#if not defined(_MSC_VER) -# if not(__cpp_lib_constexpr_string > 201911) +#if not(__cpp_lib_constexpr_string > 201911) class string { public: constexpr string() = default; @@ -87,10 +87,10 @@ class string { _length = 0; } }; -# else -# include +#else +# include using std::string; -# endif +#endif constexpr string itoa(int num, int base = 10) { @@ -178,20 +178,9 @@ string format(format_string fmt, const Args&... args) return out; } -void Use() +int main() { auto str = format("ds", 12457, " hello"); printf("'%s'", str.data()); -} -#else -void Use() -{ -# pragma message("not supported") -} -#endif - -int main() -{ - Use(); } \ No newline at end of file diff --git a/12.21-constantEvalutedAndConsteval0/CMakeLists.txt b/12.21-constantEvalutedAndConsteval0/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/12.21-constantEvalutedAndConsteval0/CMakeLists.txt +++ b/12.21-constantEvalutedAndConsteval0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.22-constantEvalutedAndConsteval1/CMakeLists.txt b/12.22-constantEvalutedAndConsteval1/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/12.22-constantEvalutedAndConsteval1/CMakeLists.txt +++ b/12.22-constantEvalutedAndConsteval1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.23-constexprStaticInitFiasco0/CMakeLists.txt b/12.23-constexprStaticInitFiasco0/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/12.23-constexprStaticInitFiasco0/CMakeLists.txt +++ b/12.23-constexprStaticInitFiasco0/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.24-constexprStaticInitFiasco1/CMakeLists.txt b/12.24-constexprStaticInitFiasco1/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/12.24-constexprStaticInitFiasco1/CMakeLists.txt +++ b/12.24-constexprStaticInitFiasco1/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.25-constexprStaticInitFiasco2/CMakeLists.txt b/12.25-constexprStaticInitFiasco2/CMakeLists.txt index 5587f18..114d0a0 100644 --- a/12.25-constexprStaticInitFiasco2/CMakeLists.txt +++ b/12.25-constexprStaticInitFiasco2/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/12.26-constexprStaticInitFiasco3/CMakeLists.txt b/12.26-constexprStaticInitFiasco3/CMakeLists.txt index 78367b8..ed3d91e 100644 --- a/12.26-constexprStaticInitFiasco3/CMakeLists.txt +++ b/12.26-constexprStaticInitFiasco3/CMakeLists.txt @@ -58,7 +58,6 @@ if(MSVC) add_definitions(/wd4996) # 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. add_definitions(/wd4267) add_definitions(/wd4505) - add_definitions(/await) # enable coroutine support # Use sane and nice C++ for MSVC. # This makes alternative tokens (not, and, ...) as actual keywords and diff --git a/Readme.md b/Readme.md index 500dbdb..a367a36 100644 --- a/Readme.md +++ b/Readme.md @@ -6,7 +6,7 @@ ## Code examples -This repository contains runnable source code examples from the 1. edition of [Programming with C++20 - Concepts, Coroutines, Ranges, and more](https://andreasfertig.info/books/programming-with-cpp20/), by [Andreas Fertig](https://andreasfertig.info). +This repository contains runnable source code examples from the 1. edition of [Programming with C++20 - Concepts, Coroutines, Ranges, and more](https://andreasfertig.com/books/programming-with-cpp20/), by [Andreas Fertig](https://andreasfertig.com). ### The layout of the examples