diff --git a/CMakeLists.txt b/CMakeLists.txt
index fa557d6..a0b0724 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,7 @@ if(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake)")
add_definitions(-Wall -Wextra)
endif()
-file(GLOB_RECURSE FLUENT_SOURCES fluent++/*.cpp fluent++/*.hpp)
+file(GLOB_RECURSE FLUENT_SOURCES fluent++/*.cpp fluent++/*.hpp fluent++/*.h)
add_library(fluent++ STATIC ${FLUENT_SOURCES})
include_directories(fluent++)
diff --git a/fluent++/Callback.h b/fluent++/Callback.h
new file mode 100644
index 0000000..90fba9c
--- /dev/null
+++ b/fluent++/Callback.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2008-2015 TrinityCore
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#ifndef _CALLBACK_H_
+#define _CALLBACK_H_
+
+#include
+#include
+#include
+
+
+template
+using Callback = std::function;
+
+template
+using SharedCallback = std::shared_ptr>;
+
+template
+using WeakCallback = std::weak_ptr>;
+
+template
+auto make_shared_callback(Callback&& callback)
+ -> SharedCallback
+{
+ return std::make_shared>(std::forward>(callback));
+}
+
+#endif /// _TASK_SCHEDULER_H_
diff --git a/fluent++/fluent++.hpp b/fluent++/fluent++.hpp
index 15c6aeb..e1a1ad2 100644
--- a/fluent++/fluent++.hpp
+++ b/fluent++/fluent++.hpp
@@ -49,7 +49,7 @@ public:
}
template
- fluent_step then(Callback const& callback)
+ fluent_step then(Callback&& callback)
{
return std::move(*this);
}
diff --git a/test.cpp b/test.cpp
index 0d9bd2a..7e48b18 100644
--- a/test.cpp
+++ b/test.cpp
@@ -1,8 +1,7 @@
#include "fluent++.hpp"
-template
-using Callback = std::function;
+#include "Callback.h"
void CastSpell(int id, Callback const& callback)
{
@@ -34,5 +33,22 @@ int main(int argc, char** argv)
std::cout << "finish everything" << std::endl;
});
+ typedef Callback cbd1;
+ typedef WeakCallback cbd2;
+ typedef SharedCallback cbd3;
+
+ cbd1 _cbd1;
+ cbd2 _cbd2;
+ cbd3 _cbd3;
+
+ auto cb = make_shared_callback([](bool)
+ {
+
+ });
+
+ auto cbt = std::make_shared>([]()
+ {
+ });
+
return 0;
}