sfxsfl 8 miesięcy temu
rodzic
commit
20fc0ae69a
100 zmienionych plików z 1694 dodań i 0 usunięć
  1. BIN
      Callback_33/.vs/Callback_33/v17/.suo
  2. BIN
      Callback_33/.vs/Callback_33/v17/Browse.VC.db
  3. BIN
      Callback_33/.vs/Callback_33/v17/ipch/AutoPCH/8985ad4e14fb65b3/CALLBACK_33.ipch
  4. 31 0
      Callback_33/Callback_33.sln
  5. 177 0
      Callback_33/Callback_33/Callback_33.cpp
  6. 139 0
      Callback_33/Callback_33/Callback_33.vcxproj
  7. 22 0
      Callback_33/Callback_33/Callback_33.vcxproj.filters
  8. 4 0
      Callback_33/Callback_33/Callback_33.vcxproj.user
  9. 11 0
      Callback_33/Callback_33/x64/Debug/Callback_33.exe.recipe
  10. BIN
      Callback_33/Callback_33/x64/Debug/Callback_33.ilk
  11. 2 0
      Callback_33/Callback_33/x64/Debug/Callback_33.log
  12. BIN
      Callback_33/Callback_33/x64/Debug/Callback_33.obj
  13. BIN
      Callback_33/Callback_33/x64/Debug/Callback_33.tlog/CL.command.1.tlog
  14. BIN
      Callback_33/Callback_33/x64/Debug/Callback_33.tlog/CL.read.1.tlog
  15. BIN
      Callback_33/Callback_33/x64/Debug/Callback_33.tlog/CL.write.1.tlog
  16. 2 0
      Callback_33/Callback_33/x64/Debug/Callback_33.tlog/Callback_33.lastbuildstate
  17. BIN
      Callback_33/Callback_33/x64/Debug/Callback_33.tlog/link.command.1.tlog
  18. BIN
      Callback_33/Callback_33/x64/Debug/Callback_33.tlog/link.read.1.tlog
  19. BIN
      Callback_33/Callback_33/x64/Debug/Callback_33.tlog/link.write.1.tlog
  20. BIN
      Callback_33/Callback_33/x64/Debug/vc143.idb
  21. BIN
      Callback_33/Callback_33/x64/Debug/vc143.pdb
  22. BIN
      Callback_33/x64/Debug/Callback_33.exe
  23. BIN
      Callback_33/x64/Debug/Callback_33.pdb
  24. BIN
      Callback_34/.vs/Callback_34/v17/.suo
  25. BIN
      Callback_34/.vs/Callback_34/v17/Browse.VC.db
  26. BIN
      Callback_34/.vs/Callback_34/v17/ipch/AutoPCH/a7ef24565b466c9d/CALLBACK_34.ipch
  27. 31 0
      Callback_34/Callback_34.sln
  28. 124 0
      Callback_34/Callback_34/Callback_34.cpp
  29. 135 0
      Callback_34/Callback_34/Callback_34.vcxproj
  30. 22 0
      Callback_34/Callback_34/Callback_34.vcxproj.filters
  31. 4 0
      Callback_34/Callback_34/Callback_34.vcxproj.user
  32. 11 0
      Callback_34/Callback_34/x64/Debug/Callback_34.exe.recipe
  33. BIN
      Callback_34/Callback_34/x64/Debug/Callback_34.ilk
  34. 2 0
      Callback_34/Callback_34/x64/Debug/Callback_34.log
  35. BIN
      Callback_34/Callback_34/x64/Debug/Callback_34.obj
  36. BIN
      Callback_34/Callback_34/x64/Debug/Callback_34.tlog/CL.command.1.tlog
  37. BIN
      Callback_34/Callback_34/x64/Debug/Callback_34.tlog/CL.read.1.tlog
  38. BIN
      Callback_34/Callback_34/x64/Debug/Callback_34.tlog/CL.write.1.tlog
  39. 2 0
      Callback_34/Callback_34/x64/Debug/Callback_34.tlog/Callback_34.lastbuildstate
  40. BIN
      Callback_34/Callback_34/x64/Debug/Callback_34.tlog/link.command.1.tlog
  41. BIN
      Callback_34/Callback_34/x64/Debug/Callback_34.tlog/link.read.1.tlog
  42. BIN
      Callback_34/Callback_34/x64/Debug/Callback_34.tlog/link.write.1.tlog
  43. BIN
      Callback_34/Callback_34/x64/Debug/vc143.idb
  44. BIN
      Callback_34/Callback_34/x64/Debug/vc143.pdb
  45. BIN
      Callback_34/x64/Debug/Callback_34.exe
  46. BIN
      Callback_34/x64/Debug/Callback_34.pdb
  47. BIN
      Callback_35/.vs/Callback_35/v17/.suo
  48. BIN
      Callback_35/.vs/Callback_35/v17/Browse.VC.db
  49. BIN
      Callback_35/.vs/Callback_35/v17/Browse.VC.db-shm
  50. 0 0
      Callback_35/.vs/Callback_35/v17/Browse.VC.db-wal
  51. BIN
      Callback_35/.vs/Callback_35/v17/Browse.VC.opendb
  52. BIN
      Callback_35/.vs/Callback_35/v17/ipch/AutoPCH/5adc1a227c20331e/HEADER1.ipch
  53. BIN
      Callback_35/.vs/Callback_35/v17/ipch/AutoPCH/60c830c3b9ad8247/CALLBACK_35.ipch
  54. BIN
      Callback_35/.vs/Callback_35/v17/ipch/AutoPCH/c9a58de502382f27/HEADER.ipch
  55. 31 0
      Callback_35/Callback_35.sln
  56. 191 0
      Callback_35/Callback_35/Callback_35.cpp
  57. 139 0
      Callback_35/Callback_35/Callback_35.vcxproj
  58. 30 0
      Callback_35/Callback_35/Callback_35.vcxproj.filters
  59. 4 0
      Callback_35/Callback_35/Callback_35.vcxproj.user
  60. 132 0
      Callback_35/Callback_35/Header.h
  61. 179 0
      Callback_35/Callback_35/Header1.h
  62. 11 0
      Callback_35/Callback_35/x64/Debug/Callback_35.exe.recipe
  63. BIN
      Callback_35/Callback_35/x64/Debug/Callback_35.ilk
  64. 2 0
      Callback_35/Callback_35/x64/Debug/Callback_35.log
  65. BIN
      Callback_35/Callback_35/x64/Debug/Callback_35.obj
  66. BIN
      Callback_35/Callback_35/x64/Debug/Callback_35.tlog/CL.command.1.tlog
  67. BIN
      Callback_35/Callback_35/x64/Debug/Callback_35.tlog/CL.read.1.tlog
  68. BIN
      Callback_35/Callback_35/x64/Debug/Callback_35.tlog/CL.write.1.tlog
  69. 2 0
      Callback_35/Callback_35/x64/Debug/Callback_35.tlog/Callback_35.lastbuildstate
  70. BIN
      Callback_35/Callback_35/x64/Debug/Callback_35.tlog/link.command.1.tlog
  71. BIN
      Callback_35/Callback_35/x64/Debug/Callback_35.tlog/link.read.1.tlog
  72. BIN
      Callback_35/Callback_35/x64/Debug/Callback_35.tlog/link.write.1.tlog
  73. BIN
      Callback_35/Callback_35/x64/Debug/vc143.idb
  74. BIN
      Callback_35/Callback_35/x64/Debug/vc143.pdb
  75. BIN
      Callback_35/x64/Debug/Callback_35.exe
  76. BIN
      Callback_35/x64/Debug/Callback_35.pdb
  77. BIN
      Callback_36/.vs/Callback_36/v17/.suo
  78. BIN
      Callback_36/.vs/Callback_36/v17/Browse.VC.db
  79. BIN
      Callback_36/.vs/Callback_36/v17/Browse.VC.db-shm
  80. 0 0
      Callback_36/.vs/Callback_36/v17/Browse.VC.db-wal
  81. BIN
      Callback_36/.vs/Callback_36/v17/Browse.VC.opendb
  82. BIN
      Callback_36/.vs/Callback_36/v17/ipch/AutoPCH/24207eaf390e39e5/CALLBACK_36.ipch
  83. 31 0
      Callback_36/Callback_36.sln
  84. 47 0
      Callback_36/Callback_36/Callback_36.cpp
  85. 135 0
      Callback_36/Callback_36/Callback_36.vcxproj
  86. 22 0
      Callback_36/Callback_36/Callback_36.vcxproj.filters
  87. 4 0
      Callback_36/Callback_36/Callback_36.vcxproj.user
  88. 11 0
      Callback_36/Callback_36/x64/Debug/Callback_36.exe.recipe
  89. BIN
      Callback_36/Callback_36/x64/Debug/Callback_36.ilk
  90. 2 0
      Callback_36/Callback_36/x64/Debug/Callback_36.log
  91. BIN
      Callback_36/Callback_36/x64/Debug/Callback_36.obj
  92. BIN
      Callback_36/Callback_36/x64/Debug/Callback_36.tlog/CL.command.1.tlog
  93. BIN
      Callback_36/Callback_36/x64/Debug/Callback_36.tlog/CL.read.1.tlog
  94. BIN
      Callback_36/Callback_36/x64/Debug/Callback_36.tlog/CL.write.1.tlog
  95. 2 0
      Callback_36/Callback_36/x64/Debug/Callback_36.tlog/Callback_36.lastbuildstate
  96. BIN
      Callback_36/Callback_36/x64/Debug/Callback_36.tlog/link.command.1.tlog
  97. BIN
      Callback_36/Callback_36/x64/Debug/Callback_36.tlog/link.read.1.tlog
  98. BIN
      Callback_36/Callback_36/x64/Debug/Callback_36.tlog/link.write.1.tlog
  99. BIN
      Callback_36/Callback_36/x64/Debug/vc143.idb
  100. BIN
      Callback_36/Callback_36/x64/Debug/vc143.pdb

BIN
Callback_33/.vs/Callback_33/v17/.suo


BIN
Callback_33/.vs/Callback_33/v17/Browse.VC.db


BIN
Callback_33/.vs/Callback_33/v17/ipch/AutoPCH/8985ad4e14fb65b3/CALLBACK_33.ipch


+ 31 - 0
Callback_33/Callback_33.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.2.32630.192
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Callback_33", "Callback_33\Callback_33.vcxproj", "{6BA42821-3E6F-4E10-B213-969739004BA3}"
+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
+		{6BA42821-3E6F-4E10-B213-969739004BA3}.Debug|x64.ActiveCfg = Debug|x64
+		{6BA42821-3E6F-4E10-B213-969739004BA3}.Debug|x64.Build.0 = Debug|x64
+		{6BA42821-3E6F-4E10-B213-969739004BA3}.Debug|x86.ActiveCfg = Debug|Win32
+		{6BA42821-3E6F-4E10-B213-969739004BA3}.Debug|x86.Build.0 = Debug|Win32
+		{6BA42821-3E6F-4E10-B213-969739004BA3}.Release|x64.ActiveCfg = Release|x64
+		{6BA42821-3E6F-4E10-B213-969739004BA3}.Release|x64.Build.0 = Release|x64
+		{6BA42821-3E6F-4E10-B213-969739004BA3}.Release|x86.ActiveCfg = Release|Win32
+		{6BA42821-3E6F-4E10-B213-969739004BA3}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {A17FEDFC-7279-4628-BA87-57086E0A609B}
+	EndGlobalSection
+EndGlobal

+ 177 - 0
Callback_33/Callback_33/Callback_33.cpp

@@ -0,0 +1,177 @@
+// Callback_19.cpp : Diese Datei enthält die Funktion "main". Hier beginnt und endet die Ausführung des Programms.
+//
+
+#include <iostream>
+/**
+ * Example code for:
+ *   - callback storage with std::vector
+ *   - use of std::function
+ *   - use of std::bind
+ *   - use of lambda function as callback
+ */
+
+#include <cstdint>
+#include <cstdio>
+#include <functional>
+#include <vector>
+
+
+ /**
+  * Basic std::function callback example. Templated on a function signature
+  * that takes in a uint32_t and returns void.
+  */
+
+struct myData {
+	int myAge = 55;
+	const char* pchar = "myData struct";
+	enum en_sex { MALE, FEMALE, DIVERS } sex = MALE;
+};
+
+struct myOtherData : myData {
+	int myOtherAge = 35;
+};
+
+
+/**
+ * Alternative storage implementation.  Perhaps you want to store
+ * callbacks for different event types?
+ */
+enum my_events_t
+{
+	VIDEO_STOP = 0,
+	VIDEO_START,
+	VIDEO_PAUS,
+	EVENT_MAX
+};
+
+struct cb_event_t
+{
+	std::function<void(myData)> cb;
+	my_events_t event;
+};
+
+/**
+ * Event based example.  Constructed with a uint32_t.
+ * Callbacks are passed this uint32_t.
+ * Callbacks are only invoked when their event type matches the
+ * occuring event.
+ */
+class EventDriver
+{
+
+	typedef std::function<void(myData)> cb_t;
+
+public:
+
+	EventDriver() : callbacks_() {};
+
+	// Register a callback.
+	void register_callback(const cb_t& cb, const my_events_t event)
+	{
+		// add callback to end of callback list
+		callbacks_.push_back({ cb, event });
+	}
+
+	/// Call all the registered callbacks.
+	void callback(myData& val, my_events_t event) const
+	{
+		// my_events_t event = VIDEO_START;
+		// iterate through callback list and call each one
+		for (const auto& cb : callbacks_)
+		{
+			if (cb.event == event)
+			{
+				cb.cb(val);
+			}
+		}
+	}
+
+private:
+	/// Integer to pass to callbacks.
+	// myData &val_ ;
+	/// List of callback functions.
+	std::vector<cb_event_t> callbacks_;
+};
+
+
+/***********************************************************************************************************************
+ * Dummy Client #1
+ * Uses a static method for a callback.
+ */
+class Client1
+{
+public:
+	static void func(myData v)
+	{
+		printf("static member callback: %d\n", v.myAge);
+	}
+};
+
+/***********************************************************************************************************************
+ * Dummy Client #2
+ * Uses an instance method as a callback
+ */
+class Client2
+{
+public:
+	void func(myData v) const
+	{
+		printf("instance member callback: %d\n", v.myAge);
+	}
+};
+
+/***********************************************************************************************************************
+ *    Callback on a c function
+ */
+extern "C"
+{
+	static void c_client_callback(myData v)
+	{
+		printf("C function callback: %d\n", v.myAge);
+	}
+}
+
+int main()
+{
+	/**
+	 * Examples using the basic driver
+	 * This is constructed with a specific value
+	 * Each callback receives this value
+	 */
+	Client2 c2;
+	myData mydata = { 55, "myData struct", myData::MALE };
+	myOtherData myotherdata;
+
+
+	/**
+	 * Examples using the Event Driver.
+	 * Note that some callbacks will not be called -
+	 * their event type is different!
+	 */
+	EventDriver ed;
+
+	printf("Beginning of examples using the EventDriver\n");
+
+	// register a lambda function as a callback
+	ed.register_callback(
+		[&mydata](myData mydata) {
+			printf("lambda callback: %d\n", mydata.myAge);
+		},
+		VIDEO_START);
+
+	// register client2 cb using std::bind
+	ed.register_callback(std::bind(&Client2::func, &c2, std::placeholders::_1), VIDEO_START);
+
+	// register a static class method as a callback
+	ed.register_callback(&Client1::func, VIDEO_STOP);
+
+	// register a C function pointer as a callback
+	ed.register_callback(&c_client_callback, VIDEO_PAUS);
+	ed.callback(mydata, VIDEO_START);
+	ed.callback(mydata, VIDEO_STOP);
+	ed.callback(myotherdata, VIDEO_PAUS);
+
+	printf("End of examples using the EventDriver\n");
+
+	return 0;
+}

+ 139 - 0
Callback_33/Callback_33/Callback_33.vcxproj

@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>16.0</VCProjectVersion>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectGuid>{6ba42821-3e6f-4e10-b213-969739004ba3}</ProjectGuid>
+    <RootNamespace>Callback33</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+      <LanguageStandard>stdcpp17</LanguageStandard>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+      <LanguageStandard>stdcpp17</LanguageStandard>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+      <LanguageStandard>stdcpp17</LanguageStandard>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+      <LanguageStandard>stdcpp17</LanguageStandard>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="Callback_33.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 22 - 0
Callback_33/Callback_33/Callback_33.vcxproj.filters

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Quelldateien">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Headerdateien">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="Ressourcendateien">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="Callback_33.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>

+ 4 - 0
Callback_33/Callback_33/Callback_33.vcxproj.user

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup />
+</Project>

+ 11 - 0
Callback_33/Callback_33/x64/Debug/Callback_33.exe.recipe

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project>
+  <ProjectOutputs>
+    <ProjectOutput>
+      <FullPath>C:\Users\wruser\source\repos\Callback_33\x64\Debug\Callback_33.exe</FullPath>
+    </ProjectOutput>
+  </ProjectOutputs>
+  <ContentFiles />
+  <SatelliteDlls />
+  <NonRecipeFileRefs />
+</Project>

BIN
Callback_33/Callback_33/x64/Debug/Callback_33.ilk


+ 2 - 0
Callback_33/Callback_33/x64/Debug/Callback_33.log

@@ -0,0 +1,2 @@
+  Callback_33.cpp
+  Callback_33.vcxproj -> C:\Users\wruser\source\repos\Callback_33\x64\Debug\Callback_33.exe

BIN
Callback_33/Callback_33/x64/Debug/Callback_33.obj


BIN
Callback_33/Callback_33/x64/Debug/Callback_33.tlog/CL.command.1.tlog


BIN
Callback_33/Callback_33/x64/Debug/Callback_33.tlog/CL.read.1.tlog


BIN
Callback_33/Callback_33/x64/Debug/Callback_33.tlog/CL.write.1.tlog


+ 2 - 0
Callback_33/Callback_33/x64/Debug/Callback_33.tlog/Callback_33.lastbuildstate

@@ -0,0 +1,2 @@
+PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.32.31326:TargetPlatformVersion=10.0.19041.0:
+Debug|x64|C:\Users\wruser\source\repos\Callback_33\|

BIN
Callback_33/Callback_33/x64/Debug/Callback_33.tlog/link.command.1.tlog


BIN
Callback_33/Callback_33/x64/Debug/Callback_33.tlog/link.read.1.tlog


BIN
Callback_33/Callback_33/x64/Debug/Callback_33.tlog/link.write.1.tlog


BIN
Callback_33/Callback_33/x64/Debug/vc143.idb


BIN
Callback_33/Callback_33/x64/Debug/vc143.pdb


BIN
Callback_33/x64/Debug/Callback_33.exe


BIN
Callback_33/x64/Debug/Callback_33.pdb


BIN
Callback_34/.vs/Callback_34/v17/.suo


BIN
Callback_34/.vs/Callback_34/v17/Browse.VC.db


BIN
Callback_34/.vs/Callback_34/v17/ipch/AutoPCH/a7ef24565b466c9d/CALLBACK_34.ipch


+ 31 - 0
Callback_34/Callback_34.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.2.32630.192
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Callback_34", "Callback_34\Callback_34.vcxproj", "{CA18CCA4-281B-4919-B99B-7CAD78F7F370}"
+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
+		{CA18CCA4-281B-4919-B99B-7CAD78F7F370}.Debug|x64.ActiveCfg = Debug|x64
+		{CA18CCA4-281B-4919-B99B-7CAD78F7F370}.Debug|x64.Build.0 = Debug|x64
+		{CA18CCA4-281B-4919-B99B-7CAD78F7F370}.Debug|x86.ActiveCfg = Debug|Win32
+		{CA18CCA4-281B-4919-B99B-7CAD78F7F370}.Debug|x86.Build.0 = Debug|Win32
+		{CA18CCA4-281B-4919-B99B-7CAD78F7F370}.Release|x64.ActiveCfg = Release|x64
+		{CA18CCA4-281B-4919-B99B-7CAD78F7F370}.Release|x64.Build.0 = Release|x64
+		{CA18CCA4-281B-4919-B99B-7CAD78F7F370}.Release|x86.ActiveCfg = Release|Win32
+		{CA18CCA4-281B-4919-B99B-7CAD78F7F370}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {26BF0407-8662-40BE-A36F-CF76ED7DEAA5}
+	EndGlobalSection
+EndGlobal

+ 124 - 0
Callback_34/Callback_34/Callback_34.cpp

@@ -0,0 +1,124 @@
+#include <typeinfo>
+#include <typeindex>
+#include <unordered_map>
+#include <iostream>
+
+using namespace std;
+
+template <typename R>
+class MultiFuncObject {
+    unordered_map<type_index, void (*)()> m_funcs;
+public:
+
+    MultiFuncObject<R> operator +=(R(*f)()) {
+        m_funcs[typeid(R())] = (void (*)()) f;
+        return *this;
+    }
+
+    template <typename A1>
+    MultiFuncObject<R> operator +=(R(*f)(A1)) {
+        m_funcs[typeid(R(A1))] = (void (*)()) f;
+        return *this;
+    }
+
+    template <typename A1, typename A2>
+    MultiFuncObject<R> operator +=(R(*f)(A1, A2)) {
+        m_funcs[typeid(R(A1, A2))] = (void (*)()) f;
+        return *this;
+    }
+
+    template <typename A1, typename A2, typename A3>
+    MultiFuncObject<R> operator +=(R(*f)(A1, A2, A3)) {
+        m_funcs[typeid(R(A1, A2, A3))] = (void (*)()) f;
+        return *this;
+    }
+
+    R operator()() const
+    {
+        unordered_map<type_index, void (*)()>::const_iterator it = m_funcs.find(typeid(R()));
+        if (it != m_funcs.end()) {
+            R(*f)() = (R(*)())(it->second);
+            (*f)();
+        }
+    }
+
+    template <typename A1>
+    R operator()(A1 a1) const
+    {
+        unordered_map<type_index, void (*)()>::const_iterator it = m_funcs.find(typeid(R(A1)));
+        if (it != m_funcs.end()) {
+            R(*f)(A1) = (R(*)(A1))(it->second);
+            (*f)(a1);
+        }
+    }
+
+    template <typename A1, typename A2>
+    R operator()(A1 a1, A2 a2) const
+    {
+        unordered_map<type_index, void (*)()>::const_iterator it = m_funcs.find(typeid(R(A1, A2)));
+        if (it != m_funcs.end()) {
+            R(*f)(A1, A2) = (R(*)(A1, A2))(it->second);
+            (*f)(a1, a2);
+        }
+    }
+
+    template <typename A1, typename A2, typename A3>
+    R operator()(A1 a1, A2 a2, A3 a3) const
+    {
+        unordered_map<type_index, void (*)()>::const_iterator it = m_funcs.find(typeid(R(A1, A2, A3)));
+        if (it != m_funcs.end()) {
+            R(*f)(A1, A2, A3) = (R(*)(A1, A2, A3))(it->second);
+            (*f)(a1, a2, a3);
+        }
+    }
+};
+
+struct myData {
+    int myAge = 55;
+    const char* pchar = "myData struct";
+    enum en_sex { MALE, FEMALE, DIVERS } sex = MALE;
+};
+
+struct myOtherData : myData {
+    int myOtherAge = 35;
+};
+
+
+void _1() {
+    cout << "_1" << endl;
+}
+
+void _2(myData* a) {
+    cout << "_2" << " " << a->pchar << endl;
+}
+
+void _3(myData* a, myOtherData* b) {
+    b->myOtherAge = 25;
+    cout << "_3" << " " << b->myOtherAge << endl;
+}
+
+void _4(myData* a, myOtherData* b, int c) {
+    b->myOtherAge = c;
+    cout << "_3" << " " << b->myOtherAge << endl;
+}
+
+
+
+int main() {
+
+    myData mydata = { 55, "myData struct", myData::MALE };
+    myOtherData myotherdata;
+
+    MultiFuncObject<void> funcs;
+    funcs += &_1;
+    funcs += &_2;
+    funcs += &_3;
+    funcs += &_4;
+
+    funcs();
+    funcs(&mydata);
+    funcs(&mydata, &myotherdata); 
+    funcs(&mydata, &myotherdata, 15);
+
+    return 0;
+}

+ 135 - 0
Callback_34/Callback_34/Callback_34.vcxproj

@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>16.0</VCProjectVersion>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectGuid>{ca18cca4-281b-4919-b99b-7cad78f7f370}</ProjectGuid>
+    <RootNamespace>Callback34</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="Callback_34.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 22 - 0
Callback_34/Callback_34/Callback_34.vcxproj.filters

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Quelldateien">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Headerdateien">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="Ressourcendateien">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="Callback_34.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>

+ 4 - 0
Callback_34/Callback_34/Callback_34.vcxproj.user

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup />
+</Project>

+ 11 - 0
Callback_34/Callback_34/x64/Debug/Callback_34.exe.recipe

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project>
+  <ProjectOutputs>
+    <ProjectOutput>
+      <FullPath>C:\Users\wruser\source\repos\Callback_34\x64\Debug\Callback_34.exe</FullPath>
+    </ProjectOutput>
+  </ProjectOutputs>
+  <ContentFiles />
+  <SatelliteDlls />
+  <NonRecipeFileRefs />
+</Project>

BIN
Callback_34/Callback_34/x64/Debug/Callback_34.ilk


+ 2 - 0
Callback_34/Callback_34/x64/Debug/Callback_34.log

@@ -0,0 +1,2 @@
+  Callback_34.cpp
+  Callback_34.vcxproj -> C:\Users\wruser\source\repos\Callback_34\x64\Debug\Callback_34.exe

BIN
Callback_34/Callback_34/x64/Debug/Callback_34.obj


BIN
Callback_34/Callback_34/x64/Debug/Callback_34.tlog/CL.command.1.tlog


BIN
Callback_34/Callback_34/x64/Debug/Callback_34.tlog/CL.read.1.tlog


BIN
Callback_34/Callback_34/x64/Debug/Callback_34.tlog/CL.write.1.tlog


+ 2 - 0
Callback_34/Callback_34/x64/Debug/Callback_34.tlog/Callback_34.lastbuildstate

@@ -0,0 +1,2 @@
+PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.32.31326:TargetPlatformVersion=10.0.19041.0:
+Debug|x64|C:\Users\wruser\source\repos\Callback_34\|

BIN
Callback_34/Callback_34/x64/Debug/Callback_34.tlog/link.command.1.tlog


BIN
Callback_34/Callback_34/x64/Debug/Callback_34.tlog/link.read.1.tlog


BIN
Callback_34/Callback_34/x64/Debug/Callback_34.tlog/link.write.1.tlog


BIN
Callback_34/Callback_34/x64/Debug/vc143.idb


BIN
Callback_34/Callback_34/x64/Debug/vc143.pdb


BIN
Callback_34/x64/Debug/Callback_34.exe


BIN
Callback_34/x64/Debug/Callback_34.pdb


BIN
Callback_35/.vs/Callback_35/v17/.suo


BIN
Callback_35/.vs/Callback_35/v17/Browse.VC.db


BIN
Callback_35/.vs/Callback_35/v17/Browse.VC.db-shm


+ 0 - 0
Callback_35/.vs/Callback_35/v17/Browse.VC.db-wal


BIN
Callback_35/.vs/Callback_35/v17/Browse.VC.opendb


BIN
Callback_35/.vs/Callback_35/v17/ipch/AutoPCH/5adc1a227c20331e/HEADER1.ipch


BIN
Callback_35/.vs/Callback_35/v17/ipch/AutoPCH/60c830c3b9ad8247/CALLBACK_35.ipch


BIN
Callback_35/.vs/Callback_35/v17/ipch/AutoPCH/c9a58de502382f27/HEADER.ipch


+ 31 - 0
Callback_35/Callback_35.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.2.32630.192
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Callback_35", "Callback_35\Callback_35.vcxproj", "{8C972562-AEA5-40FC-8162-EC2BF5110407}"
+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
+		{8C972562-AEA5-40FC-8162-EC2BF5110407}.Debug|x64.ActiveCfg = Debug|x64
+		{8C972562-AEA5-40FC-8162-EC2BF5110407}.Debug|x64.Build.0 = Debug|x64
+		{8C972562-AEA5-40FC-8162-EC2BF5110407}.Debug|x86.ActiveCfg = Debug|Win32
+		{8C972562-AEA5-40FC-8162-EC2BF5110407}.Debug|x86.Build.0 = Debug|Win32
+		{8C972562-AEA5-40FC-8162-EC2BF5110407}.Release|x64.ActiveCfg = Release|x64
+		{8C972562-AEA5-40FC-8162-EC2BF5110407}.Release|x64.Build.0 = Release|x64
+		{8C972562-AEA5-40FC-8162-EC2BF5110407}.Release|x86.ActiveCfg = Release|Win32
+		{8C972562-AEA5-40FC-8162-EC2BF5110407}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {A790F1A7-3B24-41E4-9033-430E7BAFA6F2}
+	EndGlobalSection
+EndGlobal

+ 191 - 0
Callback_35/Callback_35/Callback_35.cpp

@@ -0,0 +1,191 @@
+// Callback_19.cpp : Diese Datei enthält die Funktion "main". Hier beginnt und endet die Ausführung des Programms.
+//
+
+#include <iostream>
+/**
+ * Example code for:
+ *   - callback storage with std::vector
+ *   - use of std::function
+ *   - use of std::bind
+ *   - use of lambda function as callback
+ */
+
+#include <cstdint>
+#include <cstdio>
+#include <functional>
+#include <vector>
+#include "Header.h"
+#include "Header1.h"
+
+
+
+void _1() {
+	cout << "_1" << endl;
+}
+
+void _2(myData* a) {
+	cout << "_2" << " " << a->pchar << endl;
+}
+
+void _3(myData* a, myOtherData* b) {
+	b->myOtherAge = 25;
+	cout << "_3" << " " << b->myOtherAge << endl;
+}
+
+void _4(myData* a, myOtherData* b, int c) {
+	b->myOtherAge = c;
+	cout << "_3" << " " << b->myOtherAge << endl;
+}
+
+#if 0
+
+int main()
+{
+	/**
+	 * Examples using the basic driver
+	 * This is constructed with a specific value
+	 * Each callback receives this value
+	 */
+	Client2 c2;
+	myData mydata = { 55, "myData struct", myData::MALE };
+	myOtherData myotherdata;
+
+
+	/**
+	 * Examples using the Event Driver.
+	 * Note that some callbacks will not be called -
+	 * their event type is different!
+	 */
+	EventDriver ed;
+
+	printf("Beginning of examples using the EventDriver\n");
+
+	// register a lambda function as a callback
+	ed.register_callback(
+		[&mydata](myData mydata) {
+			printf("lambda callback: %d\n", mydata.myAge);
+		},
+		VIDEO_START);
+
+	// register client2 cb using std::bind
+	ed.register_callback(std::bind(&Client2::func, &c2, std::placeholders::_1), VIDEO_START);
+
+	// register a static class method as a callback
+	ed.register_callback(&Client1::func, VIDEO_STOP);
+
+	// register a C function pointer as a callback
+	ed.register_callback(&c_client_callback, VIDEO_PAUS);
+	ed.callback(mydata, VIDEO_START);
+	ed.callback(mydata, VIDEO_STOP);
+	ed.callback(myotherdata, VIDEO_PAUS);
+
+	printf("End of examples using the EventDriver\n");
+
+	return 0;
+}
+
+#else
+
+/**
+ * Alternative storage implementation.  Perhaps you want to store
+ * callbacks for different event types?
+ */
+struct cb_event_t2
+{
+	std::function<void(myData)> cb;
+	my_events_t event;
+};
+/**
+ * Event based example.  Constructed with a uint32_t.
+ * Callbacks are passed this uint32_t.
+ * Callbacks are only invoked when their event type matches the
+ * occuring event.
+ */
+class EventDriverNew
+{
+
+	typedef std::function<void(myData)> cb_t;
+
+	// MultiFuncObject<void> funcs;
+	// typedef std::function<void(MultiFuncObject)> cb_t2;
+
+public:
+
+	EventDriverNew() : callbacks_() {};
+
+	// Register a callback.
+	void register_callback(const cb_t& cb, const my_events_t event)
+	{
+		// add callback to end of callback list
+		callbacks_.push_back({ cb, event });
+	}
+
+	/// Call all the registered callbacks.
+	void callback(myData& val, my_events_t event) const
+	{
+		// my_events_t event = VIDEO_START;
+		// iterate through callback list and call each one
+		for (const auto& cb : callbacks_)
+		{
+			if (cb.event == event)
+			{
+				cb.cb(val);
+			}
+		}
+	}
+
+private:
+	/// Integer to pass to callbacks.
+	// myData &val_ ;
+	/// List of callback functions.
+	std::vector<cb_event_t> callbacks_;
+};
+
+
+
+
+class helper {
+
+	EventDriverNew ed;
+	myData mydata = { 15, "myData struct", myData::FEMALE };
+
+public:
+	void cb_register() {
+
+		ed.register_callback(
+			[this](myData mydata) {
+				printf("lambda callback: %d\n", mydata.myAge);
+			},
+			VIDEO_START);
+	};
+
+	void cb_callback() {
+		ed.callback(mydata, VIDEO_START);
+	}
+};
+
+int main() {
+
+	helper help; 
+
+	myData mydata = { 55, "myData struct", myData::MALE };
+	myOtherData myotherdata;
+
+	help.cb_register();
+	help.cb_callback();
+
+	MultiFuncObject<void> funcs;
+	funcs += &_1;
+	funcs += &_2;
+	funcs += &_3;
+	funcs += &_4;
+
+	funcs();
+	funcs(&mydata);
+	funcs(&mydata, &myotherdata);
+	funcs(&mydata, &myotherdata, 15);
+
+	return 0;
+}
+
+#endif

+ 139 - 0
Callback_35/Callback_35/Callback_35.vcxproj

@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>16.0</VCProjectVersion>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectGuid>{8c972562-aea5-40fc-8162-ec2bf5110407}</ProjectGuid>
+    <RootNamespace>Callback35</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="Callback_35.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Header.h" />
+    <ClInclude Include="Header1.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 30 - 0
Callback_35/Callback_35/Callback_35.vcxproj.filters

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Quelldateien">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Headerdateien">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="Ressourcendateien">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="Callback_35.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Header.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="Header1.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

+ 4 - 0
Callback_35/Callback_35/Callback_35.vcxproj.user

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup />
+</Project>

+ 132 - 0
Callback_35/Callback_35/Header.h

@@ -0,0 +1,132 @@
+#pragma once
+
+/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ *
+ */
+
+ /**
+  * Basic std::function callback example. Templated on a function signature
+  * that takes in a uint32_t and returns void.
+  */
+
+struct myData {
+    int myAge = 55;
+    const char* pchar = "myData struct";
+    enum en_sex { MALE, FEMALE, DIVERS } sex = MALE;
+};
+
+struct myOtherData : myData {
+    int myOtherAge = 35;
+};
+
+
+/**
+ * Alternative storage implementation.  Perhaps you want to store
+ * callbacks for different event types?
+ */
+enum my_events_t
+{
+    VIDEO_STOP = 0,
+    VIDEO_START,
+    VIDEO_PAUS,
+    EVENT_MAX
+};
+
+/**
+ * Alternative storage implementation.  Perhaps you want to store
+ * callbacks for different event types?
+ */
+struct cb_event_t
+{
+	std::function<void(myData)> cb;
+	my_events_t event;
+};
+
+
+
+/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ *
+ */
+
+
+
+/***********************************************************************************************************************
+ * Dummy Client #1
+ * Uses a static method for a callback.
+ */
+class Client1
+{
+public:
+    static void func(myData v)
+    {
+        printf("static member callback: %d\n", v.myAge);
+    }
+};
+
+/***********************************************************************************************************************
+ * Dummy Client #2
+ * Uses an instance method as a callback
+ */
+class Client2
+{
+public:
+    void func(myData v) const
+    {
+        printf("instance member callback: %d\n", v.myAge);
+    }
+};
+
+/***********************************************************************************************************************
+ *    Callback on a c function
+ */
+extern "C"
+{
+    static void c_client_callback(myData v)
+    {
+        printf("C function callback: %d\n", v.myAge);
+    }
+}
+
+
+/**
+ * Event based example.  Constructed with a uint32_t.
+ * Callbacks are passed this uint32_t.
+ * Callbacks are only invoked when their event type matches the
+ * occuring event.
+ */
+class EventDriver
+{
+
+	typedef std::function<void(myData)> cb_t;
+
+public:
+
+	EventDriver() : callbacks_() {};
+
+	// Register a callback.
+	void register_callback(const cb_t& cb, const my_events_t event)
+	{
+		// add callback to end of callback list
+		callbacks_.push_back({ cb, event });
+	}
+
+	/// Call all the registered callbacks.
+	void callback(myData& val, my_events_t event) const
+	{
+		// my_events_t event = VIDEO_START;
+		// iterate through callback list and call each one
+		for (const auto& cb : callbacks_)
+		{
+			if (cb.event == event)
+			{
+				cb.cb(val);
+			}
+		}
+	}
+
+private:
+	/// Integer to pass to callbacks.
+	// myData &val_ ;
+	/// List of callback functions.
+	std::vector<cb_event_t> callbacks_;
+};

+ 179 - 0
Callback_35/Callback_35/Header1.h

@@ -0,0 +1,179 @@
+#pragma once
+
+#include <typeinfo>
+#include <typeindex>
+#include <unordered_map>
+#include <iostream>
+
+using namespace std;
+
+template <typename R>
+class MultiFuncObject {
+    unordered_map<type_index, void (*)()> m_funcs;
+
+
+public:
+
+    MultiFuncObject<R> operator +=(R(*f)()) {
+        // auto _r0_ = make_pair(1, typeid(R()));
+        m_funcs[typeid(R())] = (void (*)()) f;
+        return *this;
+    }
+
+    template <typename A1>
+    MultiFuncObject<R> operator +=(R(*f)(A1)) {
+        m_funcs[typeid(R(A1))] = (void (*)()) f;
+        return *this;
+    }
+
+    template <typename A1, typename A2>
+    MultiFuncObject<R> operator +=(R(*f)(A1, A2)) {
+        m_funcs[typeid(R(A1, A2))] = (void (*)()) f;
+        return *this;
+    }
+
+    template <typename A1, typename A2, typename A3>
+    MultiFuncObject<R> operator +=(R(*f)(A1, A2, A3)) {
+        m_funcs[typeid(R(A1, A2, A3))] = (void (*)()) f;
+        return *this;
+    }
+
+    R operator()() const
+    {
+        unordered_map<type_index, void (*)()>::const_iterator it = m_funcs.find(typeid(R()));       
+        if (it != m_funcs.end()) {
+            R(*f)() = (R(*)())(it->second);
+            (*f)();
+        }
+    }
+
+    template <typename A1>
+    R operator()(A1 a1) const
+    {
+        unordered_map<type_index, void (*)()>::const_iterator it = m_funcs.find(typeid(R(A1)));
+        if (it != m_funcs.end()) {
+            R(*f)(A1) = (R(*)(A1))(it->second);
+            (*f)(a1);
+        }
+    }
+
+    template <typename A1, typename A2>
+    R operator()(A1 a1, A2 a2) const
+    {
+        unordered_map<type_index, void (*)()>::const_iterator it = m_funcs.find(typeid(R(A1, A2)));
+        if (it != m_funcs.end()) {
+            R(*f)(A1, A2) = (R(*)(A1, A2))(it->second);
+            (*f)(a1, a2);
+        }
+    }
+
+    template <typename A1, typename A2, typename A3>
+    R operator()(A1 a1, A2 a2, A3 a3) const
+    {
+        unordered_map<type_index, void (*)()>::const_iterator it = m_funcs.find(typeid(R(A1, A2, A3)));
+        if (it != m_funcs.end()) {
+            R(*f)(A1, A2, A3) = (R(*)(A1, A2, A3))(it->second);
+            (*f)(a1, a2, a3);
+        }
+    }
+};
+
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+#if 0
+
+template <typename R>
+class NewMultiFuncObject {
+    unordered_map<std::pair<int, type_index>, void (*)()> m_funcs; // 
+public:
+
+    NewMultiFuncObject<R> operator +=(R(*f)()) {
+        // m_funcs[make_pair(1, typeid(R()))] = (void (*)()) f;
+        return *this;
+    }
+
+    template <typename A1>
+    NewMultiFuncObject<R> operator +=(R(*f)(A1)) {
+        // m_funcs[make_pair(1, typeid(R(A1)))] = (void (*)()) f;
+        return *this;
+    }
+
+    template <typename A1, typename A2>
+    NewMultiFuncObject<R> operator +=(R(*f)(A1, A2)) {
+        // m_funcs[make_pair(1, typeid(R(A1, A2)))] = (void (*)()) f;
+        return *this;
+    }
+
+    template <typename A1, typename A2, typename A3>
+    NewMultiFuncObject<R> operator +=(R(*f)(A1, A2, A3)) {
+        // m_funcs[make_pair(1, typeid(R(A1, A2, A3)))] = (void (*)()) f;
+        return *this;
+    }
+
+    R operator()() const
+    {
+        unordered_map<std::pair<int, type_index>, void (*)()>::const_iterator it = m_funcs.find(make_pair(1, typeid(R())));
+        if (it != m_funcs.end()) {
+     //       R(*f)() = (R(*)())(it->second);
+     //       (*f)();
+        }
+    }
+
+    template <typename A1>
+    R operator()(A1 a1) const
+    {
+        unordered_map<std::pair<int, type_index>, void (*)()>::const_iterator it = m_funcs.find(make_pair(1, typeid(R(A1))));
+        if (it != m_funcs.end()) {
+       //     R(*f)(A1) = (R(*)(A1))(it->second);
+       //     (*f)(a1);
+        }
+    }
+
+    template <typename A1, typename A2>
+    R operator()(A1 a1, A2 a2) const
+    {
+        unordered_map<std::pair<int, type_index>, void (*)()>::const_iterator it = m_funcs.find(make_pair(1, typeid(R(A1, A2))));
+        if (it != m_funcs.end()) {
+       //     R(*f)(A1, A2) = (R(*)(A1, A2))(it->second);
+       //     (*f)(a1, a2);
+        }
+    }
+
+    template <typename A1, typename A2, typename A3>
+    R operator()(A1 a1, A2 a2, A3 a3) const
+    {
+        unordered_map<std::pair<int, type_index>, void (*)()>::const_iterator it = m_funcs.find(make_pair(1, typeid(R(A1, A2, A3))));
+        if (it != m_funcs.end()) {
+        //    R(*f)(A1, A2, A3) = (R(*)(A1, A2, A3))(it->second);
+        //    (*f)(a1, a2, a3);
+        }
+    }
+};
+#endif
+
+#if 1
+
+template <typename R>
+class NewMultiFuncObject {
+    unordered_map<type_index, void (*)()> m_funcs; 
+    unordered_map<string, unordered_map<std::pair<std::int32_t, type_index>, void (*)()>> m_funcs2;
+
+public:
+
+    NewMultiFuncObject<R> operator +=(R(*f)()) {
+        m_funcs2["test"][typeid(R())] = (void (*)()) f;
+        return *this;
+    }
+
+    R operator()() const
+    {
+        unordered_map<type_index , void (*)()>::const_iterator it = m_funcs.find(typeid(R()));
+        if (it != m_funcs.end()) {
+           R(*f)() = (R(*)())(it->second);
+           (*f)();
+        }
+    }
+};
+
+#endif
+

+ 11 - 0
Callback_35/Callback_35/x64/Debug/Callback_35.exe.recipe

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project>
+  <ProjectOutputs>
+    <ProjectOutput>
+      <FullPath>C:\Users\wruser\source\repos\Callback_35\x64\Debug\Callback_35.exe</FullPath>
+    </ProjectOutput>
+  </ProjectOutputs>
+  <ContentFiles />
+  <SatelliteDlls />
+  <NonRecipeFileRefs />
+</Project>

BIN
Callback_35/Callback_35/x64/Debug/Callback_35.ilk


+ 2 - 0
Callback_35/Callback_35/x64/Debug/Callback_35.log

@@ -0,0 +1,2 @@
+  Callback_35.cpp
+  Callback_35.vcxproj -> C:\Users\wruser\source\repos\Callback_35\x64\Debug\Callback_35.exe

BIN
Callback_35/Callback_35/x64/Debug/Callback_35.obj


BIN
Callback_35/Callback_35/x64/Debug/Callback_35.tlog/CL.command.1.tlog


BIN
Callback_35/Callback_35/x64/Debug/Callback_35.tlog/CL.read.1.tlog


BIN
Callback_35/Callback_35/x64/Debug/Callback_35.tlog/CL.write.1.tlog


+ 2 - 0
Callback_35/Callback_35/x64/Debug/Callback_35.tlog/Callback_35.lastbuildstate

@@ -0,0 +1,2 @@
+PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.32.31326:TargetPlatformVersion=10.0.19041.0:
+Debug|x64|C:\Users\wruser\source\repos\Callback_35\|

BIN
Callback_35/Callback_35/x64/Debug/Callback_35.tlog/link.command.1.tlog


BIN
Callback_35/Callback_35/x64/Debug/Callback_35.tlog/link.read.1.tlog


BIN
Callback_35/Callback_35/x64/Debug/Callback_35.tlog/link.write.1.tlog


BIN
Callback_35/Callback_35/x64/Debug/vc143.idb


BIN
Callback_35/Callback_35/x64/Debug/vc143.pdb


BIN
Callback_35/x64/Debug/Callback_35.exe


BIN
Callback_35/x64/Debug/Callback_35.pdb


BIN
Callback_36/.vs/Callback_36/v17/.suo


BIN
Callback_36/.vs/Callback_36/v17/Browse.VC.db


BIN
Callback_36/.vs/Callback_36/v17/Browse.VC.db-shm


+ 0 - 0
Callback_36/.vs/Callback_36/v17/Browse.VC.db-wal


BIN
Callback_36/.vs/Callback_36/v17/Browse.VC.opendb


BIN
Callback_36/.vs/Callback_36/v17/ipch/AutoPCH/24207eaf390e39e5/CALLBACK_36.ipch


+ 31 - 0
Callback_36/Callback_36.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.2.32630.192
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Callback_36", "Callback_36\Callback_36.vcxproj", "{9DB70E3F-E1AF-4126-99C7-5DC0FDCB7AFF}"
+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
+		{9DB70E3F-E1AF-4126-99C7-5DC0FDCB7AFF}.Debug|x64.ActiveCfg = Debug|x64
+		{9DB70E3F-E1AF-4126-99C7-5DC0FDCB7AFF}.Debug|x64.Build.0 = Debug|x64
+		{9DB70E3F-E1AF-4126-99C7-5DC0FDCB7AFF}.Debug|x86.ActiveCfg = Debug|Win32
+		{9DB70E3F-E1AF-4126-99C7-5DC0FDCB7AFF}.Debug|x86.Build.0 = Debug|Win32
+		{9DB70E3F-E1AF-4126-99C7-5DC0FDCB7AFF}.Release|x64.ActiveCfg = Release|x64
+		{9DB70E3F-E1AF-4126-99C7-5DC0FDCB7AFF}.Release|x64.Build.0 = Release|x64
+		{9DB70E3F-E1AF-4126-99C7-5DC0FDCB7AFF}.Release|x86.ActiveCfg = Release|Win32
+		{9DB70E3F-E1AF-4126-99C7-5DC0FDCB7AFF}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {CBF16AE7-36DB-42C2-A6A9-7E5D6A37141E}
+	EndGlobalSection
+EndGlobal

+ 47 - 0
Callback_36/Callback_36/Callback_36.cpp

@@ -0,0 +1,47 @@
+// Callback_36.cpp : Diese Datei enthält die Funktion "main". Hier beginnt und endet die Ausführung des Programms.
+//
+
+#include <iostream>
+#include <type_traits>
+#include <functional>
+#include <type_traits>
+#include <utility>
+
+// https://stackoverflow.com/questions/55554765/pass-function-pointer-into-variadic-template-function
+
+
+struct cTest {
+
+    int testVar = 12;
+};
+
+void printint(int i)
+{
+    std::cout << "int" << std::endl;
+}
+
+void printstr(const char  *p)
+{
+    std::cout << "string" << std::endl;
+}
+
+void printcTest(cTest *p)
+{
+    std::cout << "cTest" << std::endl;
+    p->testVar = 14; 
+}
+
+template <typename... Args>
+void run_callback(const std::common_type_t<std::function<void(Args...)>>& func, Args... as)
+{
+    func(std::forward<Args>(as)...);  // call the callback
+}
+
+int main() {
+    cTest ctest; 
+
+    run_callback(printint, 1);
+    run_callback(printstr, "Test");
+    run_callback(printcTest, &ctest);
+
+}

+ 135 - 0
Callback_36/Callback_36/Callback_36.vcxproj

@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>16.0</VCProjectVersion>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectGuid>{9db70e3f-e1af-4126-99c7-5dc0fdcb7aff}</ProjectGuid>
+    <RootNamespace>Callback36</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="Callback_36.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 22 - 0
Callback_36/Callback_36/Callback_36.vcxproj.filters

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Quelldateien">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Headerdateien">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="Ressourcendateien">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="Callback_36.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>

+ 4 - 0
Callback_36/Callback_36/Callback_36.vcxproj.user

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup />
+</Project>

+ 11 - 0
Callback_36/Callback_36/x64/Debug/Callback_36.exe.recipe

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project>
+  <ProjectOutputs>
+    <ProjectOutput>
+      <FullPath>C:\Users\wruser\source\repos\Callback_36\x64\Debug\Callback_36.exe</FullPath>
+    </ProjectOutput>
+  </ProjectOutputs>
+  <ContentFiles />
+  <SatelliteDlls />
+  <NonRecipeFileRefs />
+</Project>

BIN
Callback_36/Callback_36/x64/Debug/Callback_36.ilk


+ 2 - 0
Callback_36/Callback_36/x64/Debug/Callback_36.log

@@ -0,0 +1,2 @@
+  Callback_36.cpp
+  Callback_36.vcxproj -> C:\Users\wruser\source\repos\Callback_36\x64\Debug\Callback_36.exe

BIN
Callback_36/Callback_36/x64/Debug/Callback_36.obj


BIN
Callback_36/Callback_36/x64/Debug/Callback_36.tlog/CL.command.1.tlog


BIN
Callback_36/Callback_36/x64/Debug/Callback_36.tlog/CL.read.1.tlog


BIN
Callback_36/Callback_36/x64/Debug/Callback_36.tlog/CL.write.1.tlog


+ 2 - 0
Callback_36/Callback_36/x64/Debug/Callback_36.tlog/Callback_36.lastbuildstate

@@ -0,0 +1,2 @@
+PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.32.31326:TargetPlatformVersion=10.0.19041.0:
+Debug|x64|C:\Users\wruser\source\repos\Callback_36\|

BIN
Callback_36/Callback_36/x64/Debug/Callback_36.tlog/link.command.1.tlog


BIN
Callback_36/Callback_36/x64/Debug/Callback_36.tlog/link.read.1.tlog


BIN
Callback_36/Callback_36/x64/Debug/Callback_36.tlog/link.write.1.tlog


BIN
Callback_36/Callback_36/x64/Debug/vc143.idb


BIN
Callback_36/Callback_36/x64/Debug/vc143.pdb


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików