From 4f31812b3491c2bc61b983e8a18bb6e9f7858100 Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Tue, 2 Jul 2024 13:21:53 +0100 Subject: [PATCH 01/16] Test GitVersion behviour --- .github/workflows/msbuild.yml | 2 +- GitAction/Program.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index 5b54db7..e65a12d 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -3,7 +3,7 @@ name: MSBuild on: # Triggers the workflow on push or pull request events but only for the main branch push: - branches: [ main ] + branches: [ main, release ] pull_request: branches: [ main ] diff --git a/GitAction/Program.cs b/GitAction/Program.cs index dc1fca1..86ea237 100644 --- a/GitAction/Program.cs +++ b/GitAction/Program.cs @@ -13,6 +13,7 @@ static void Main(string[] args) // The code provided will print ‘Hello World’ to the console. // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app. Console.WriteLine("Hello World!"); + Console.ReadKey(); // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app! From 93c2d604b0e97a0a5e36c28901b5369773be0435 Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Tue, 2 Jul 2024 13:33:59 +0100 Subject: [PATCH 02/16] update checkout and msbuild --- .github/workflows/VStest.yml | 4 ++-- .github/workflows/msbuild.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/VStest.yml b/.github/workflows/VStest.yml index 465e848..5ad5f49 100644 --- a/.github/workflows/VStest.yml +++ b/.github/workflows/VStest.yml @@ -21,12 +21,12 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: 'recursive' # Ensure submodules are fetched - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.0.2 + uses: microsoft/setup-msbuild@v2 - name: Restore NuGet packages working-directory: ${{env.GITHUB_WORKSPACE}} diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index e65a12d..1dbdbf7 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -21,12 +21,12 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.0.2 + uses: microsoft/setup-msbuild@v2 - name: Restore NuGet packages working-directory: ${{env.GITHUB_WORKSPACE}} From 3c6596902e33750afb9f78ea6b599dda50693469 Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Tue, 2 Jul 2024 13:52:31 +0100 Subject: [PATCH 03/16] update checkout and gitversion version --- .github/workflows/VStest.yml | 2 +- .github/workflows/msbuild.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/VStest.yml b/.github/workflows/VStest.yml index 5ad5f49..e4d791f 100644 --- a/.github/workflows/VStest.yml +++ b/.github/workflows/VStest.yml @@ -21,7 +21,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: 'recursive' # Ensure submodules are fetched diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index 1dbdbf7..16d902c 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -21,7 +21,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -39,9 +39,9 @@ jobs: run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0.9.7 + uses: gittools/actions/gitversion/setup@v1.1.1 with: versionSpec: '5.x' - name: Determine Version - uses: gittools/actions/gitversion/execute@v0.9.7 + uses: gittools/actions/gitversion/execute@v1.1.1 From 107ced1321253da9ab769a93b18efb2fd3909cc2 Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Tue, 2 Jul 2024 14:06:12 +0100 Subject: [PATCH 04/16] Add GitVersion.yml --- GitAction/GitVersion.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 GitAction/GitVersion.yml diff --git a/GitAction/GitVersion.yml b/GitAction/GitVersion.yml new file mode 100644 index 0000000..ebdfba1 --- /dev/null +++ b/GitAction/GitVersion.yml @@ -0,0 +1,6 @@ +assembly-versioning-scheme: MajorMinorPatch +mode: ContinuousDeployment +branches: {} +ignore: + sha: [] +merge-message-formats: {} From d67d9ee9fc2d1382fde89194541e55bc6e4d7803 Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Tue, 2 Jul 2024 14:49:48 +0100 Subject: [PATCH 05/16] Update of Program.cs to try to trigger GitVersion #123 --- GitAction/Program.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/GitAction/Program.cs b/GitAction/Program.cs index 86ea237..45fb959 100644 --- a/GitAction/Program.cs +++ b/GitAction/Program.cs @@ -14,6 +14,7 @@ static void Main(string[] args) // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app. Console.WriteLine("Hello World!"); + Console.ReadKey(); // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app! From 9629cfc6409aba2e9e6696745fac5070e6caad42 Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Tue, 2 Jul 2024 14:58:27 +0100 Subject: [PATCH 06/16] +semver: major: Trying to bump major version --- GitAction/gitversion.json | 52 +++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/GitAction/gitversion.json b/GitAction/gitversion.json index 65912b7..3776269 100644 --- a/GitAction/gitversion.json +++ b/GitAction/gitversion.json @@ -2,34 +2,34 @@ "Major": 0, "Minor": 1, "Patch": 0, - "PreReleaseTag": "gitversion.1", - "PreReleaseTagWithDash": "-gitversion.1", - "PreReleaseLabel": "gitversion", - "PreReleaseLabelWithDash": "-gitversion", - "PreReleaseNumber": 1, - "WeightedPreReleaseNumber": 1, - "BuildMetaData": 39, - "BuildMetaDataPadded": "0039", - "FullBuildMetaData": "39.Branch.gitversion.Sha.828ba5fbbde9a4d7bf635cd59005b85d98c8b24a", + "PreReleaseTag": "release.223", + "PreReleaseTagWithDash": "-release.223", + "PreReleaseLabel": "release", + "PreReleaseLabelWithDash": "-release", + "PreReleaseNumber": 223, + "WeightedPreReleaseNumber": 223, + "BuildMetaData": null, + "BuildMetaDataPadded": "", + "FullBuildMetaData": "Branch.release.Sha.107ced1321253da9ab769a93b18efb2fd3909cc2", "MajorMinorPatch": "0.1.0", - "SemVer": "0.1.0-gitversion.1", - "LegacySemVer": "0.1.0-gitversion1", - "LegacySemVerPadded": "0.1.0-gitversion0001", + "SemVer": "0.1.0-release.223", + "LegacySemVer": "0.1.0-release223", + "LegacySemVerPadded": "0.1.0-release0223", "AssemblySemVer": "0.1.0.0", "AssemblySemFileVer": "0.1.0.0", - "FullSemVer": "0.1.0-gitversion.1+39", - "InformationalVersion": "0.1.0-gitversion.1+39.Branch.gitversion.Sha.828ba5fbbde9a4d7bf635cd59005b85d98c8b24a", - "BranchName": "gitversion", - "EscapedBranchName": "gitversion", - "Sha": "828ba5fbbde9a4d7bf635cd59005b85d98c8b24a", - "ShortSha": "828ba5f", - "NuGetVersionV2": "0.1.0-gitversion0001", - "NuGetVersion": "0.1.0-gitversion0001", - "NuGetPreReleaseTagV2": "gitversion0001", - "NuGetPreReleaseTag": "gitversion0001", + "FullSemVer": "0.1.0-release.223", + "InformationalVersion": "0.1.0-release.223+Branch.release.Sha.107ced1321253da9ab769a93b18efb2fd3909cc2", + "BranchName": "release", + "EscapedBranchName": "release", + "Sha": "107ced1321253da9ab769a93b18efb2fd3909cc2", + "ShortSha": "107ced1", + "NuGetVersionV2": "0.1.0-release0223", + "NuGetVersion": "0.1.0-release0223", + "NuGetPreReleaseTagV2": "release0223", + "NuGetPreReleaseTag": "release0223", "VersionSourceSha": "ed58148b4d0d02ea8fd6f7954e5b241d92ee9a61", - "CommitsSinceVersionSource": 39, - "CommitsSinceVersionSourcePadded": "0039", - "UncommittedChanges": 894, - "CommitDate": "2022-03-05" + "CommitsSinceVersionSource": 223, + "CommitsSinceVersionSourcePadded": "0223", + "UncommittedChanges": 248, + "CommitDate": "2024-07-02" } \ No newline at end of file From 55946ed15ed551dfc8ca4d87281f4ad02eb0d47a Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Tue, 2 Jul 2024 15:10:43 +0100 Subject: [PATCH 07/16] cahnge with tag --- GitAction/Program.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/GitAction/Program.cs b/GitAction/Program.cs index 45fb959..86ea237 100644 --- a/GitAction/Program.cs +++ b/GitAction/Program.cs @@ -14,7 +14,6 @@ static void Main(string[] args) // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app. Console.WriteLine("Hello World!"); - Console.ReadKey(); // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app! From a5c3c96958479a3a00e48e0f43a07fea06250a1b Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Wed, 3 Jul 2024 21:22:21 +0100 Subject: [PATCH 08/16] change with tag --- GitAction/Program.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/GitAction/Program.cs b/GitAction/Program.cs index 86ea237..dc1fca1 100644 --- a/GitAction/Program.cs +++ b/GitAction/Program.cs @@ -13,7 +13,6 @@ static void Main(string[] args) // The code provided will print ‘Hello World’ to the console. // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app. Console.WriteLine("Hello World!"); - Console.ReadKey(); // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app! From ebce147a9c8e4f7710bc0989161fa07b3a6f234e Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Thu, 4 Jul 2024 07:39:00 +0100 Subject: [PATCH 09/16] Test auto release --- .github/workflows/AutoRelease.yml | 24 ++++++++++++++++++++++++ CHANGELOG.md | 1 + 2 files changed, 25 insertions(+) create mode 100644 .github/workflows/AutoRelease.yml create mode 100644 CHANGELOG.md diff --git a/.github/workflows/AutoRelease.yml b/.github/workflows/AutoRelease.yml new file mode 100644 index 0000000..1ffd6bc --- /dev/null +++ b/.github/workflows/AutoRelease.yml @@ -0,0 +1,24 @@ +name: AutoRelease + +on: + push: + branches: [ main, release ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + release: + # The type of runner that the job will run on + runs-on: windows-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Auto Release on Commit + uses: softprops/action-gh-release@v1 + with: + title: Version ${{ env.semver }} + changelog: CHANGELOG.md + regex: 'v\d+\.\d+\.\d+' # Customize the version pattern \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ff57201 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1 @@ +My changes test \ No newline at end of file From 51fe7598d9ffc7854335a4526bda2fba72965efb Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Thu, 4 Jul 2024 07:54:59 +0100 Subject: [PATCH 10/16] Change after tag --- UnitTest/UnitTest1/HelperFunctions.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/UnitTest/UnitTest1/HelperFunctions.cpp b/UnitTest/UnitTest1/HelperFunctions.cpp index c91e641..aa38c8a 100644 --- a/UnitTest/UnitTest1/HelperFunctions.cpp +++ b/UnitTest/UnitTest1/HelperFunctions.cpp @@ -3,6 +3,7 @@ #include #include + using namespace std; char* HelperFunctions::GetEnvVariable(std::string name) From a8b7273ea3a267c39ec6619a29c5d019f5e63f0c Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Thu, 4 Jul 2024 08:47:40 +0100 Subject: [PATCH 11/16] Test auto tag increment --- .github/workflows/AutoRelease.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/AutoRelease.yml b/.github/workflows/AutoRelease.yml index 1ffd6bc..46668fe 100644 --- a/.github/workflows/AutoRelease.yml +++ b/.github/workflows/AutoRelease.yml @@ -6,19 +6,18 @@ on: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - release: - # The type of runner that the job will run on - runs-on: windows-latest - - # Steps represent a sequence of tasks that will be executed as part of the job + update-tag: + runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Auto Release on Commit - uses: softprops/action-gh-release@v1 + - name: Check out repository code + uses: actions/checkout@v3 + - name: Get the latest tag + id: get_tag + run: echo "::set-output name=tag::$(git describe --tags --abbrev=0)" + - name: Increment version + id: increment_version + run: echo "::set-output name=version::$(echo ${{ steps.get_tag.outputs.tag }} | awk -F. '{$NF = $NF + 1;} 1' OFS=.)" + - name: Push new tag + uses: EndBug/latest-tag@latest with: - title: Version ${{ env.semver }} - changelog: CHANGELOG.md - regex: 'v\d+\.\d+\.\d+' # Customize the version pattern \ No newline at end of file + tag-name: "v${{ steps.increment_version.outputs.version }}" \ No newline at end of file From 82db41576b1515e8dc2dea8bdfd81a539fdd2abb Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Mon, 10 Feb 2025 11:27:52 +0000 Subject: [PATCH 12/16] Simple sort example --- .../Sort/ExampleForSort/ExampleForSort.cpp | 69 +++++++++ .../Sort/ExampleForSort/ExampleForSort.sln | 28 ++++ .../ExampleForSort/ExampleForSort.vcxproj | 135 ++++++++++++++++++ .../ExampleForSort.vcxproj.filters | 22 +++ .../ExampleForSort.vcxproj.user | 4 + 5 files changed, 258 insertions(+) create mode 100644 C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.cpp create mode 100644 C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.sln create mode 100644 C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj create mode 100644 C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.filters create mode 100644 C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.user diff --git a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.cpp b/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.cpp new file mode 100644 index 0000000..4ee157b --- /dev/null +++ b/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.cpp @@ -0,0 +1,69 @@ +// ExampleForSort.cpp : This file contains the 'main' function. Program execution begins and ends there. +// + +#include +#include +#include +#include +#include + +void generateRandomNumbers(std::vector& vec, int size) { + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution<> dis(1, 10000); + + vec.clear(); + vec.reserve(size); + for (int i = 0; i < size; ++i) { + vec.push_back(dis(gen)); + } +} + + +void measurePerformance(const std::vector& vec, const std::string& description) { + auto start = std::chrono::high_resolution_clock::now(); + std::vector sortedVec = vec; + std::sort(sortedVec.begin(), sortedVec.end()); + auto end = std::chrono::high_resolution_clock::now(); + std::chrono::duration sortDuration = end - start; + std::cout << "Time taken to sort " << description << ": " << sortDuration.count() << " seconds\n"; + + start = std::chrono::high_resolution_clock::now(); + bool isSorted = std::is_sorted(sortedVec.begin(), sortedVec.end()); + end = std::chrono::high_resolution_clock::now(); + std::chrono::duration checkDuration = end - start; + std::cout << "Time taken to check if sorted " << description << ": " << checkDuration.count() << " seconds\n"; + std::cout << "Array is sorted: " << (isSorted ? "true" : "false") << "\n"; + + if (description == "already sorted array") { + std::cout << "Performance improvement for checking sorted array: " + << (sortDuration.count() / checkDuration.count()) << " times faster\n"; + } +} + +int main() +{ + const int size = 10000000; + std::vector vec; + generateRandomNumbers(vec, size); + + std::cout << "Performance with random array:\n"; + measurePerformance(vec, "random array"); + + std::cout << "\nPerformance with already sorted array:\n"; + std::sort(vec.begin(), vec.end()); + measurePerformance(vec, "already sorted array"); + + return 0; +} + +// Run program: Ctrl + F5 or Debug > Start Without Debugging menu +// Debug program: F5 or Debug > Start Debugging menu + +// Tips for Getting Started: +// 1. Use the Solution Explorer window to add/manage files +// 2. Use the Team Explorer window to connect to source control +// 3. Use the Output window to see build output and other messages +// 4. Use the Error List window to view errors +// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project +// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file diff --git a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.sln b/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.sln new file mode 100644 index 0000000..1c860a1 --- /dev/null +++ b/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35707.178 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExampleForSort", "ExampleForSort.vcxproj", "{0BD47328-C55F-437D-8981-36784B03D239}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0BD47328-C55F-437D-8981-36784B03D239}.Debug|x64.ActiveCfg = Debug|x64 + {0BD47328-C55F-437D-8981-36784B03D239}.Debug|x64.Build.0 = Debug|x64 + {0BD47328-C55F-437D-8981-36784B03D239}.Debug|x86.ActiveCfg = Debug|Win32 + {0BD47328-C55F-437D-8981-36784B03D239}.Debug|x86.Build.0 = Debug|Win32 + {0BD47328-C55F-437D-8981-36784B03D239}.Release|x64.ActiveCfg = Release|x64 + {0BD47328-C55F-437D-8981-36784B03D239}.Release|x64.Build.0 = Release|x64 + {0BD47328-C55F-437D-8981-36784B03D239}.Release|x86.ActiveCfg = Release|Win32 + {0BD47328-C55F-437D-8981-36784B03D239}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj b/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj new file mode 100644 index 0000000..98ec1af --- /dev/null +++ b/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {0bd47328-c55f-437d-8981-36784b03d239} + ExampleForSort + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.filters b/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.filters new file mode 100644 index 0000000..022a4df --- /dev/null +++ b/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + \ No newline at end of file diff --git a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.user b/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file From c6e5684cfd21a9eeea198a5c506b9c44d25fb465 Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Tue, 25 Aug 2026 16:41:02 +0100 Subject: [PATCH 13/16] cleanup existing c++ and add rule of 5 example --- C++/C++.sln | 2 +- C++/Forward/Forward.cpp | 26 ---- .../ConsoleApplication1.vcxproj.filters | 22 --- .../ConsoleApplication1.vcxproj.user | 4 - ...leApplication1.cpp => LambdaFunctions.cpp} | 4 + C++/LambdaFunctions/LambdaFunctions.vcxproj | 8 +- .../Sort/ExampleForSort/ExampleForSort.sln | 28 ---- .../ExampleForSort/ExampleForSort.vcxproj | 135 ------------------ .../ExampleForSort.vcxproj.filters | 22 --- .../ExampleForSort.vcxproj.user | 4 - ...ExampleForSort.cpp => SortPerformance.cpp} | 20 +-- C++/LambdaFunctions/SortPerformance.h | 4 + C++/MoveSemantics/DynamicBuffer.cpp | 64 +++++++++ C++/MoveSemantics/DynamicBuffer.h | 34 +++++ C++/MoveSemantics/MoveSemantics.cpp | 55 +++++++ .../MoveSemantics.vcxproj} | 6 +- .../MoveSemantics.vcxproj.filters} | 10 +- .../MoveSemantics.vcxproj.user} | 0 C++/{Forward => MoveSemantics}/MoveUnique.h | 0 19 files changed, 184 insertions(+), 264 deletions(-) delete mode 100644 C++/Forward/Forward.cpp delete mode 100644 C++/LambdaFunctions/ConsoleApplication1.vcxproj.filters delete mode 100644 C++/LambdaFunctions/ConsoleApplication1.vcxproj.user rename C++/LambdaFunctions/{ConsoleApplication1.cpp => LambdaFunctions.cpp} (95%) delete mode 100644 C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.sln delete mode 100644 C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj delete mode 100644 C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.filters delete mode 100644 C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.user rename C++/LambdaFunctions/{Sort/ExampleForSort/ExampleForSort.cpp => SortPerformance.cpp} (69%) create mode 100644 C++/LambdaFunctions/SortPerformance.h create mode 100644 C++/MoveSemantics/DynamicBuffer.cpp create mode 100644 C++/MoveSemantics/DynamicBuffer.h create mode 100644 C++/MoveSemantics/MoveSemantics.cpp rename C++/{Forward/Forward.vcxproj => MoveSemantics/MoveSemantics.vcxproj} (97%) rename C++/{Forward/Forward.vcxproj.filters => MoveSemantics/MoveSemantics.vcxproj.filters} (81%) rename C++/{Forward/Forward.vcxproj.user => MoveSemantics/MoveSemantics.vcxproj.user} (100%) rename C++/{Forward => MoveSemantics}/MoveUnique.h (100%) diff --git a/C++/C++.sln b/C++/C++.sln index b092771..7901ba2 100644 --- a/C++/C++.sln +++ b/C++/C++.sln @@ -7,7 +7,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LambdaFunctions", "LambdaFu EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InputOutput", "InputOutput\InputOutput.vcxproj", "{60CD8FE7-EB95-403D-A0E2-5E89188BA387}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Forward", "Forward\Forward.vcxproj", "{1135FA47-DE13-4E20-8EC0-C01BFD96B155}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MoveSemantics", "MoveSemantics\MoveSemantics.vcxproj", "{1135FA47-DE13-4E20-8EC0-C01BFD96B155}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Regex", "Regex\Regex.vcxproj", "{2134645E-A12D-4143-898F-C2D5C9DE5F4F}" EndProject diff --git a/C++/Forward/Forward.cpp b/C++/Forward/Forward.cpp deleted file mode 100644 index c1757b8..0000000 --- a/C++/Forward/Forward.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Forward.cpp : This file contains the 'main' function. Program execution begins and ends there. -// -#include -#include - -void ProcessData(int& data) { - std::cout << "Processing lvalue data: " << data << std::endl; -} - -void ProcessData(int&& data) { - std::cout << "Processing rvalue data: " << data << std::endl; -} - -template -void DataWrapper(T&& data) { - ProcessData(std::forward(data)); //we need to be careful to preserve original value categories - i.e an r value - //ProcessData(data); //This case will call ProcessData(int& data) -} - -int main() { - int x = 42; - DataWrapper(5); // Should call ProcessData(int&&) - DataWrapper(x); // Should call ProcessData(int&) - return 0; -} - diff --git a/C++/LambdaFunctions/ConsoleApplication1.vcxproj.filters b/C++/LambdaFunctions/ConsoleApplication1.vcxproj.filters deleted file mode 100644 index 6713fa5..0000000 --- a/C++/LambdaFunctions/ConsoleApplication1.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/C++/LambdaFunctions/ConsoleApplication1.vcxproj.user b/C++/LambdaFunctions/ConsoleApplication1.vcxproj.user deleted file mode 100644 index 88a5509..0000000 --- a/C++/LambdaFunctions/ConsoleApplication1.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/C++/LambdaFunctions/ConsoleApplication1.cpp b/C++/LambdaFunctions/LambdaFunctions.cpp similarity index 95% rename from C++/LambdaFunctions/ConsoleApplication1.cpp rename to C++/LambdaFunctions/LambdaFunctions.cpp index 9c7dd3e..881cd89 100644 --- a/C++/LambdaFunctions/ConsoleApplication1.cpp +++ b/C++/LambdaFunctions/LambdaFunctions.cpp @@ -4,6 +4,7 @@ #include #include #include +#include "SortPerformance.h" class MyClass { public: @@ -62,5 +63,8 @@ int main() std::cout << "No object with an even value found." << std::endl; } + std::cout << std::endl; + RunSortPerformanceExample(); + return 0; } diff --git a/C++/LambdaFunctions/LambdaFunctions.vcxproj b/C++/LambdaFunctions/LambdaFunctions.vcxproj index 5546008..65538ed 100644 --- a/C++/LambdaFunctions/LambdaFunctions.vcxproj +++ b/C++/LambdaFunctions/LambdaFunctions.vcxproj @@ -22,7 +22,7 @@ 16.0 Win32Proj {9eb235c6-2f83-4da8-969b-0f1e9dc735c8} - ConsoleApplication1 + LambdaFunctions 10.0 @@ -140,7 +140,11 @@ - + + + + + diff --git a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.sln b/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.sln deleted file mode 100644 index 1c860a1..0000000 --- a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.12.35707.178 d17.12 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExampleForSort", "ExampleForSort.vcxproj", "{0BD47328-C55F-437D-8981-36784B03D239}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0BD47328-C55F-437D-8981-36784B03D239}.Debug|x64.ActiveCfg = Debug|x64 - {0BD47328-C55F-437D-8981-36784B03D239}.Debug|x64.Build.0 = Debug|x64 - {0BD47328-C55F-437D-8981-36784B03D239}.Debug|x86.ActiveCfg = Debug|Win32 - {0BD47328-C55F-437D-8981-36784B03D239}.Debug|x86.Build.0 = Debug|Win32 - {0BD47328-C55F-437D-8981-36784B03D239}.Release|x64.ActiveCfg = Release|x64 - {0BD47328-C55F-437D-8981-36784B03D239}.Release|x64.Build.0 = Release|x64 - {0BD47328-C55F-437D-8981-36784B03D239}.Release|x86.ActiveCfg = Release|Win32 - {0BD47328-C55F-437D-8981-36784B03D239}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj b/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj deleted file mode 100644 index 98ec1af..0000000 --- a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj +++ /dev/null @@ -1,135 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - Win32Proj - {0bd47328-c55f-437d-8981-36784b03d239} - ExampleForSort - 10.0 - - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - \ No newline at end of file diff --git a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.filters b/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.filters deleted file mode 100644 index 022a4df..0000000 --- a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - \ No newline at end of file diff --git a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.user b/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.user deleted file mode 100644 index 88a5509..0000000 --- a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.cpp b/C++/LambdaFunctions/SortPerformance.cpp similarity index 69% rename from C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.cpp rename to C++/LambdaFunctions/SortPerformance.cpp index 4ee157b..6a22bfc 100644 --- a/C++/LambdaFunctions/Sort/ExampleForSort/ExampleForSort.cpp +++ b/C++/LambdaFunctions/SortPerformance.cpp @@ -1,6 +1,7 @@ -// ExampleForSort.cpp : This file contains the 'main' function. Program execution begins and ends there. +// SortPerformance.cpp : demonstrates measuring std::sort performance on random vs. already-sorted data. // +#include "SortPerformance.h" #include #include #include @@ -41,9 +42,9 @@ void measurePerformance(const std::vector& vec, const std::string& descript } } -int main() +void RunSortPerformanceExample() { - const int size = 10000000; + const int size = 10000; std::vector vec; generateRandomNumbers(vec, size); @@ -53,17 +54,4 @@ int main() std::cout << "\nPerformance with already sorted array:\n"; std::sort(vec.begin(), vec.end()); measurePerformance(vec, "already sorted array"); - - return 0; } - -// Run program: Ctrl + F5 or Debug > Start Without Debugging menu -// Debug program: F5 or Debug > Start Debugging menu - -// Tips for Getting Started: -// 1. Use the Solution Explorer window to add/manage files -// 2. Use the Team Explorer window to connect to source control -// 3. Use the Output window to see build output and other messages -// 4. Use the Error List window to view errors -// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project -// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file diff --git a/C++/LambdaFunctions/SortPerformance.h b/C++/LambdaFunctions/SortPerformance.h new file mode 100644 index 0000000..0b384b4 --- /dev/null +++ b/C++/LambdaFunctions/SortPerformance.h @@ -0,0 +1,4 @@ +#pragma once + +// Demonstrates measuring std::sort performance on random vs. already-sorted data. +void RunSortPerformanceExample(); diff --git a/C++/MoveSemantics/DynamicBuffer.cpp b/C++/MoveSemantics/DynamicBuffer.cpp new file mode 100644 index 0000000..9ea67d1 --- /dev/null +++ b/C++/MoveSemantics/DynamicBuffer.cpp @@ -0,0 +1,64 @@ +#include "DynamicBuffer.h" +#include + +DynamicBuffer::DynamicBuffer(std::size_t elementCount) + : m_data(new double[elementCount]{}), m_count(elementCount) +{ +} + +// 1. Destructor - releases owned memory +DynamicBuffer::~DynamicBuffer() +{ + delete[] m_data; +} + +// 2. Copy constructor - deep copies the buffer +DynamicBuffer::DynamicBuffer(const DynamicBuffer& source) + : m_data(new double[source.m_count]), m_count(source.m_count) +{ + for (std::size_t i = 0; i < m_count; ++i) + { + m_data[i] = source.m_data[i]; + } +} + +// 3. Copy assignment operator - deep copies, releasing old memory first +DynamicBuffer& DynamicBuffer::operator=(const DynamicBuffer& source) +{ + if (this != &source) + { + double* newData = new double[source.m_count]; + for (std::size_t i = 0; i < source.m_count; ++i) + { + newData[i] = source.m_data[i]; + } + + delete[] m_data; + m_data = newData; + m_count = source.m_count; + } + return *this; +} + +// 4. Move constructor - steals the pointer, leaves source empty +DynamicBuffer::DynamicBuffer(DynamicBuffer&& source) noexcept + : m_data(source.m_data), m_count(source.m_count) +{ + source.m_data = nullptr; + source.m_count = 0; +} + +// 5. Move assignment operator - releases old memory, steals new pointer +DynamicBuffer& DynamicBuffer::operator=(DynamicBuffer&& source) noexcept +{ + if (this != &source) + { + delete[] m_data; + m_data = source.m_data; + m_count = source.m_count; + + source.m_data = nullptr; + source.m_count = 0; + } + return *this; +} diff --git a/C++/MoveSemantics/DynamicBuffer.h b/C++/MoveSemantics/DynamicBuffer.h new file mode 100644 index 0000000..6677408 --- /dev/null +++ b/C++/MoveSemantics/DynamicBuffer.h @@ -0,0 +1,34 @@ +#pragma once +#include + +// Demonstrates the Rule of Five: a resource-owning class must define +// (or explicitly default) all five special member functions if it +// manages a raw resource such as heap memory. +class DynamicBuffer +{ +public: + explicit DynamicBuffer(std::size_t elementCount = 10); + + // 1. Destructor - releases owned memory + ~DynamicBuffer(); + + // 2. Copy constructor - deep copies the buffer + DynamicBuffer(const DynamicBuffer& source); + + // 3. Copy assignment operator - deep copies, releasing old memory first + DynamicBuffer& operator=(const DynamicBuffer& source); + + // 4. Move constructor - steals the pointer, leaves source empty + DynamicBuffer(DynamicBuffer&& source) noexcept; + + // 5. Move assignment operator - releases old memory, steals new pointer + DynamicBuffer& operator=(DynamicBuffer&& source) noexcept; + + std::size_t count() const noexcept { return m_count; } + double& at(std::size_t index) { return m_data[index]; } + double at(std::size_t index) const { return m_data[index]; } + +private: + double* m_data; + std::size_t m_count; +}; \ No newline at end of file diff --git a/C++/MoveSemantics/MoveSemantics.cpp b/C++/MoveSemantics/MoveSemantics.cpp new file mode 100644 index 0000000..fbb2e78 --- /dev/null +++ b/C++/MoveSemantics/MoveSemantics.cpp @@ -0,0 +1,55 @@ +// MoveSemantics.cpp : This file contains the 'main' function. Program execution begins and ends there. +// +#include +#include + +#include "DynamicBuffer.h" + +void ProcessData(int& data) { + std::cout << "Processing lvalue data: " << data << std::endl; +} + +void ProcessData(int&& data) { + std::cout << "Processing rvalue data: " << data << std::endl; +} + +template +void DataWrapper(T&& data) { + ProcessData(std::forward(data)); //we need to be careful to preserve original value categories - i.e an r value + //ProcessData(data); //This case will call ProcessData(int& data) +} + +// ---- Rule of Five demonstration (DynamicBuffer) ---- +// Shows why a class owning a raw resource (heap memory) must implement all +// five special member functions: destructor, copy ctor/assignment, and +// move ctor/assignment. +void DemonstrateRuleOfFive() +{ + DynamicBuffer bufferA(5); + bufferA.at(0) = 3.14; + + // Copy constructor: bufferB gets its own independent memory + DynamicBuffer bufferB(bufferA); + + // Copy assignment: bufferC already exists, old memory is freed first + DynamicBuffer bufferC(5); + bufferC = bufferA; + + // Move constructor: bufferD steals bufferA's pointer, bufferA becomes empty + DynamicBuffer bufferD(std::move(bufferA)); + + // Move assignment: bufferC's old memory is freed, then it steals bufferB's pointer + bufferC = std::move(bufferB); + + std::cout << "bufferD[0] = " << bufferD.at(0) << std::endl; +} + +int main() { + int x = 42; + DataWrapper(5); // Should call ProcessData(int&&) + DataWrapper(x); // Should call ProcessData(int&) + + DemonstrateRuleOfFive(); + + return 0; +} diff --git a/C++/Forward/Forward.vcxproj b/C++/MoveSemantics/MoveSemantics.vcxproj similarity index 97% rename from C++/Forward/Forward.vcxproj rename to C++/MoveSemantics/MoveSemantics.vcxproj index 798abe0..6638729 100644 --- a/C++/Forward/Forward.vcxproj +++ b/C++/MoveSemantics/MoveSemantics.vcxproj @@ -22,7 +22,7 @@ 17.0 Win32Proj {1135fa47-de13-4e20-8ec0-c01bfd96b155} - Forward + MoveSemantics 10.0 @@ -128,10 +128,12 @@ - + + + diff --git a/C++/Forward/Forward.vcxproj.filters b/C++/MoveSemantics/MoveSemantics.vcxproj.filters similarity index 81% rename from C++/Forward/Forward.vcxproj.filters rename to C++/MoveSemantics/MoveSemantics.vcxproj.filters index 3ef9480..054167e 100644 --- a/C++/Forward/Forward.vcxproj.filters +++ b/C++/MoveSemantics/MoveSemantics.vcxproj.filters @@ -15,13 +15,19 @@ - + + Source Files + + Source Files - Source Files + Header Files + + + Header Files \ No newline at end of file diff --git a/C++/Forward/Forward.vcxproj.user b/C++/MoveSemantics/MoveSemantics.vcxproj.user similarity index 100% rename from C++/Forward/Forward.vcxproj.user rename to C++/MoveSemantics/MoveSemantics.vcxproj.user diff --git a/C++/Forward/MoveUnique.h b/C++/MoveSemantics/MoveUnique.h similarity index 100% rename from C++/Forward/MoveUnique.h rename to C++/MoveSemantics/MoveUnique.h From 919789f56f5490f5b4a8131ca3b1a28b64cf0402 Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Tue, 25 Aug 2026 16:55:56 +0100 Subject: [PATCH 14/16] Move PyBind projects (PyBindAiry, PyBindGetInteger) into C++ folder and add to C++.sln --- {PyBind => C++/PyBind}/PyBindAiry/PyBindAiry.cpp | 0 .../PyBind}/PyBindAiry/PyBindAiry.filters | 0 {PyBind => C++/PyBind}/PyBindAiry/PyBindAiry.user | 0 .../PyBind}/PyBindAiry/PyBindAiry.vcxproj | 0 .../PyBind}/PyBindAiry/PyBindAiry.vcxproj.user | 0 {PyBind => C++/PyBind}/PyBindAiry/README | 0 {PyBind => C++/PyBind}/PyBindAiry/python39.dll | Bin .../PyBind}/PyBindGetInteger/PyBindGetInteger.cpp | 0 .../PyBindGetInteger/PyBindGetInteger.vcxproj | 0 .../PyBindGetInteger.vcxproj.filters | 0 .../PyBindGetInteger/PyBindGetInteger.vcxproj.user | 0 {PyBind => C++/PyBind}/PyBindGetInteger/pyemb3.py | 0 {PyBind => C++/PyBind}/PyBindGetInteger/pyhelper.h | 0 13 files changed, 0 insertions(+), 0 deletions(-) rename {PyBind => C++/PyBind}/PyBindAiry/PyBindAiry.cpp (100%) rename {PyBind => C++/PyBind}/PyBindAiry/PyBindAiry.filters (100%) rename {PyBind => C++/PyBind}/PyBindAiry/PyBindAiry.user (100%) rename {PyBind => C++/PyBind}/PyBindAiry/PyBindAiry.vcxproj (100%) rename {PyBind => C++/PyBind}/PyBindAiry/PyBindAiry.vcxproj.user (100%) rename {PyBind => C++/PyBind}/PyBindAiry/README (100%) rename {PyBind => C++/PyBind}/PyBindAiry/python39.dll (100%) rename {PyBind => C++/PyBind}/PyBindGetInteger/PyBindGetInteger.cpp (100%) rename {PyBind => C++/PyBind}/PyBindGetInteger/PyBindGetInteger.vcxproj (100%) rename {PyBind => C++/PyBind}/PyBindGetInteger/PyBindGetInteger.vcxproj.filters (100%) rename {PyBind => C++/PyBind}/PyBindGetInteger/PyBindGetInteger.vcxproj.user (100%) rename {PyBind => C++/PyBind}/PyBindGetInteger/pyemb3.py (100%) rename {PyBind => C++/PyBind}/PyBindGetInteger/pyhelper.h (100%) diff --git a/PyBind/PyBindAiry/PyBindAiry.cpp b/C++/PyBind/PyBindAiry/PyBindAiry.cpp similarity index 100% rename from PyBind/PyBindAiry/PyBindAiry.cpp rename to C++/PyBind/PyBindAiry/PyBindAiry.cpp diff --git a/PyBind/PyBindAiry/PyBindAiry.filters b/C++/PyBind/PyBindAiry/PyBindAiry.filters similarity index 100% rename from PyBind/PyBindAiry/PyBindAiry.filters rename to C++/PyBind/PyBindAiry/PyBindAiry.filters diff --git a/PyBind/PyBindAiry/PyBindAiry.user b/C++/PyBind/PyBindAiry/PyBindAiry.user similarity index 100% rename from PyBind/PyBindAiry/PyBindAiry.user rename to C++/PyBind/PyBindAiry/PyBindAiry.user diff --git a/PyBind/PyBindAiry/PyBindAiry.vcxproj b/C++/PyBind/PyBindAiry/PyBindAiry.vcxproj similarity index 100% rename from PyBind/PyBindAiry/PyBindAiry.vcxproj rename to C++/PyBind/PyBindAiry/PyBindAiry.vcxproj diff --git a/PyBind/PyBindAiry/PyBindAiry.vcxproj.user b/C++/PyBind/PyBindAiry/PyBindAiry.vcxproj.user similarity index 100% rename from PyBind/PyBindAiry/PyBindAiry.vcxproj.user rename to C++/PyBind/PyBindAiry/PyBindAiry.vcxproj.user diff --git a/PyBind/PyBindAiry/README b/C++/PyBind/PyBindAiry/README similarity index 100% rename from PyBind/PyBindAiry/README rename to C++/PyBind/PyBindAiry/README diff --git a/PyBind/PyBindAiry/python39.dll b/C++/PyBind/PyBindAiry/python39.dll similarity index 100% rename from PyBind/PyBindAiry/python39.dll rename to C++/PyBind/PyBindAiry/python39.dll diff --git a/PyBind/PyBindGetInteger/PyBindGetInteger.cpp b/C++/PyBind/PyBindGetInteger/PyBindGetInteger.cpp similarity index 100% rename from PyBind/PyBindGetInteger/PyBindGetInteger.cpp rename to C++/PyBind/PyBindGetInteger/PyBindGetInteger.cpp diff --git a/PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj b/C++/PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj similarity index 100% rename from PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj rename to C++/PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj diff --git a/PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj.filters b/C++/PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj.filters similarity index 100% rename from PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj.filters rename to C++/PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj.filters diff --git a/PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj.user b/C++/PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj.user similarity index 100% rename from PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj.user rename to C++/PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj.user diff --git a/PyBind/PyBindGetInteger/pyemb3.py b/C++/PyBind/PyBindGetInteger/pyemb3.py similarity index 100% rename from PyBind/PyBindGetInteger/pyemb3.py rename to C++/PyBind/PyBindGetInteger/pyemb3.py diff --git a/PyBind/PyBindGetInteger/pyhelper.h b/C++/PyBind/PyBindGetInteger/pyhelper.h similarity index 100% rename from PyBind/PyBindGetInteger/pyhelper.h rename to C++/PyBind/PyBindGetInteger/pyhelper.h From 69566dca5ded0b20368e0a1f120dcfd37738abe7 Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Tue, 25 Aug 2026 16:56:12 +0100 Subject: [PATCH 15/16] Add PyBind projects to C++.sln with solution folder --- C++/C++.sln | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/C++/C++.sln b/C++/C++.sln index 7901ba2..4b16bfa 100644 --- a/C++/C++.sln +++ b/C++/C++.sln @@ -11,6 +11,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MoveSemantics", "MoveSemant EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Regex", "Regex\Regex.vcxproj", "{2134645E-A12D-4143-898F-C2D5C9DE5F4F}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PyBind", "PyBind", "{9B6D7C1A-6E3F-4F0B-9E9C-0B5C6A8F2E77}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PyBindAiry", "PyBind\PyBindAiry\PyBindAiry.vcxproj", "{33B48397-2D59-4D3F-B18C-BF52CC4A3785}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PyBindGetInteger", "PyBind\PyBindGetInteger\PyBindGetInteger.vcxproj", "{4A519CF2-1985-46E5-B701-A3B48E8DE940}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -51,10 +57,30 @@ Global {2134645E-A12D-4143-898F-C2D5C9DE5F4F}.Release|x64.Build.0 = Release|x64 {2134645E-A12D-4143-898F-C2D5C9DE5F4F}.Release|x86.ActiveCfg = Release|Win32 {2134645E-A12D-4143-898F-C2D5C9DE5F4F}.Release|x86.Build.0 = Release|Win32 + {33B48397-2D59-4D3F-B18C-BF52CC4A3785}.Debug|x64.ActiveCfg = Debug|x64 + {33B48397-2D59-4D3F-B18C-BF52CC4A3785}.Debug|x64.Build.0 = Debug|x64 + {33B48397-2D59-4D3F-B18C-BF52CC4A3785}.Debug|x86.ActiveCfg = Debug|Win32 + {33B48397-2D59-4D3F-B18C-BF52CC4A3785}.Debug|x86.Build.0 = Debug|Win32 + {33B48397-2D59-4D3F-B18C-BF52CC4A3785}.Release|x64.ActiveCfg = Release|x64 + {33B48397-2D59-4D3F-B18C-BF52CC4A3785}.Release|x64.Build.0 = Release|x64 + {33B48397-2D59-4D3F-B18C-BF52CC4A3785}.Release|x86.ActiveCfg = Release|Win32 + {33B48397-2D59-4D3F-B18C-BF52CC4A3785}.Release|x86.Build.0 = Release|Win32 + {4A519CF2-1985-46E5-B701-A3B48E8DE940}.Debug|x64.ActiveCfg = Debug|x64 + {4A519CF2-1985-46E5-B701-A3B48E8DE940}.Debug|x64.Build.0 = Debug|x64 + {4A519CF2-1985-46E5-B701-A3B48E8DE940}.Debug|x86.ActiveCfg = Debug|Win32 + {4A519CF2-1985-46E5-B701-A3B48E8DE940}.Debug|x86.Build.0 = Debug|Win32 + {4A519CF2-1985-46E5-B701-A3B48E8DE940}.Release|x64.ActiveCfg = Release|x64 + {4A519CF2-1985-46E5-B701-A3B48E8DE940}.Release|x64.Build.0 = Release|x64 + {4A519CF2-1985-46E5-B701-A3B48E8DE940}.Release|x86.ActiveCfg = Release|Win32 + {4A519CF2-1985-46E5-B701-A3B48E8DE940}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {33B48397-2D59-4D3F-B18C-BF52CC4A3785} = {9B6D7C1A-6E3F-4F0B-9E9C-0B5C6A8F2E77} + {4A519CF2-1985-46E5-B701-A3B48E8DE940} = {9B6D7C1A-6E3F-4F0B-9E9C-0B5C6A8F2E77} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {A4049FF9-DC7D-4D1A-9567-76389B7C83BA} EndGlobalSection From efef33b967826ba3765db980b143a31cbb0e6e75 Mon Sep 17 00:00:00 2001 From: Bradley-Augstein_finastra Date: Tue, 25 Aug 2026 17:04:45 +0100 Subject: [PATCH 16/16] Fix PyBind projects to build against installed Python 3.12 + pip-installed pybind11 --- C++/PyBind/PyBindAiry/PyBindAiry.cpp | 27 ++++++++++++------- C++/PyBind/PyBindAiry/PyBindAiry.vcxproj | 17 +++++++----- .../PyBindGetInteger/PyBindGetInteger.vcxproj | 12 ++++++--- C++/PyBind/PyBindGetInteger/pyhelper.h | 11 ++++++++ 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/C++/PyBind/PyBindAiry/PyBindAiry.cpp b/C++/PyBind/PyBindAiry/PyBindAiry.cpp index bef2b65..345a47a 100644 --- a/C++/PyBind/PyBindAiry/PyBindAiry.cpp +++ b/C++/PyBind/PyBindAiry/PyBindAiry.cpp @@ -2,7 +2,20 @@ // #include + +// The installed Python distribution only ships release import libraries +// (no python3xx_d.lib). Temporarily undefine _DEBUG so Python.h doesn't +// request the debug-suffixed library when building this project in Debug mode. +#ifdef _DEBUG +#define PYBINDAIRY_RESTORE_DEBUG +#undef _DEBUG +#endif #include +#ifdef PYBINDAIRY_RESTORE_DEBUG +#define _DEBUG +#undef PYBINDAIRY_RESTORE_DEBUG +#endif + #include #include #include @@ -12,18 +25,14 @@ using namespace std::complex_literals; namespace py = pybind11; int main() { - std::string str = "C:/Python/Python39/"; - std::wstring widestr = std::wstring(str.begin(), str.end()); - Py_SetPythonHome(widestr.c_str()); - + // Py_SetPythonHome is deprecated since Python 3.11; the interpreter can + // locate its own installation automatically, so we no longer set it explicitly. pybind11::scoped_interpreter guard{}; pybind11::exec("print('hello world')"); - Py_Initialize(); - - PyRun_SimpleString("import scipy"); - py::object SciPy = py::module_::import("scipy.special"); - py::function airy = SciPy.attr("airy"); + PyRun_SimpleString("import scipy"); + py::object SciPy = py::module_::import("scipy.special"); + py::function airy = SciPy.attr("airy"); //double input py::object airyval = airy(1.0); diff --git a/C++/PyBind/PyBindAiry/PyBindAiry.vcxproj b/C++/PyBind/PyBindAiry/PyBindAiry.vcxproj index c69a4c5..039f3e9 100644 --- a/C++/PyBind/PyBindAiry/PyBindAiry.vcxproj +++ b/C++/PyBind/PyBindAiry/PyBindAiry.vcxproj @@ -70,22 +70,25 @@ - + + C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2800.0_x64__qbz5n2kfra8p0 + C:\Users\baugstein\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pybind11\include + true true - $(LibraryWPath) - C:\Python\Python39\libs;$(LibraryPath) + $(PythonHome)\include;$(PyBind11Include);$(PyBind11Include)\pybind11;$(IncludePath) + $(PythonHome)\libs;$(LibraryPath) false false - $(Python_39)\include;$(Python_39)\Lib\site-packages\pybind11\include\pybind11;$(IncludePath) - $(Python_39)\libs;$(Python_39)\;$(LibraryPath) + $(PythonHome)\include;$(PyBind11Include);$(PyBind11Include)\pybind11;$(IncludePath) + $(PythonHome)\libs;$(LibraryPath) @@ -115,7 +118,7 @@ Console true - python39.lib;%(AdditionalDependencies) + $(PythonHome)\libs\python312.lib;%(AdditionalDependencies) @@ -155,7 +158,7 @@ true true true - $(Python_39)\libs\python39.lib;%(AdditionalDependencies) + $(PythonHome)\libs\python312.lib;%(AdditionalDependencies) diff --git a/C++/PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj b/C++/PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj index ebf9c88..b240e99 100644 --- a/C++/PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj +++ b/C++/PyBind/PyBindGetInteger/PyBindGetInteger.vcxproj @@ -69,17 +69,21 @@ - + + C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2800.0_x64__qbz5n2kfra8p0 + false - $(Python_39)\include;$(Python_39)\Lib\site-packages\pybind11\include\pybind11;$(IncludePath) - $(Python_39)\libs;$(Python_39)\;$(LibraryPath) + $(PythonHome)\include;$(IncludePath) + $(PythonHome)\libs;$(LibraryPath) true true + $(PythonHome)\include;$(IncludePath) + $(PythonHome)\libs;$(LibraryPath) false @@ -101,6 +105,7 @@ true true true + $(PythonHome)\libs\python312.lib;%(AdditionalDependencies) @@ -131,6 +136,7 @@ Console true + $(PythonHome)\libs\python312.lib;%(AdditionalDependencies) diff --git a/C++/PyBind/PyBindGetInteger/pyhelper.h b/C++/PyBind/PyBindGetInteger/pyhelper.h index 1ff5c73..efe1cbb 100644 --- a/C++/PyBind/PyBindGetInteger/pyhelper.h +++ b/C++/PyBind/PyBindGetInteger/pyhelper.h @@ -2,7 +2,18 @@ #define PYHELPER_HPP #pragma once +// The installed Python distribution only ships release import libraries +// (no python3xx_d.lib). Temporarily undefine _DEBUG so Python.h doesn't +// request the debug-suffixed library when building this project in Debug mode. +#ifdef _DEBUG +#define PYHELPER_RESTORE_DEBUG +#undef _DEBUG +#endif #include +#ifdef PYHELPER_RESTORE_DEBUG +#define _DEBUG +#undef PYHELPER_RESTORE_DEBUG +#endif class CPyInstance {