You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[about the chaining parameter](#about-the-chaining-parameter)
41
+
-[About exceptions](#about-exceptions)
42
+
-[About the chaining parameter](#about-the-chaining-parameter)
40
43
-[Match rule for chaining parameters](#match-rule-for-chaining-parameters)
41
44
-[Resolved parameters](#resolved-parameters)
42
45
-[Rejected parameters](#rejected-parameters)
43
46
-[Omit parameters](#omit-parameters)
44
-
-[copy the promise object](#copy-the-promise-object)
45
-
-[handle uncaught exceptional or rejected parameters](#handle-uncaught-exceptional-or-rejected-parameters)
47
+
-[Copy the promise object](#copy-the-promise-object)
48
+
-[Handle uncaught exceptional or rejected parameters](#handle-uncaught-exceptional-or-rejected-parameters)
46
49
-[about multithread](#about-multithread)
47
-
48
50
<!-- /TOC -->
49
51
50
52
## What is promise-cpp ?
51
53
52
-
Promise-cpp is **header only** library that implements promise/A+ standard. (To support header only, compiled with macro PROMISE_HEADONLY)
53
-
54
-
Promise-cpp is easy to use, just #include "promise.hpp" is enough. With promise-cpp, you can resolve or reject any type of data without writing complex template code.
54
+
Promise-cpp is library that implements promise/A+ standard, which can be the base component in event-looped asychronized programming. It is NOT std::promise.
55
+
56
+
## Features
57
+
58
+
Similar to Javascript Promise API.
59
+
60
+
Type safety: the resolved/rejected arguments can be captured by the "then" function with same arguments type.
61
+
62
+
Exceptions supports: cpp exception will be received by the "on_rejected" function.
55
63
56
-
Promise-cpp is depended only on STL (c++11 or higher).
57
-
Although some of the asio examples are linked against boost library, promise-cpp itself is absolutely **workable without boost library** and can be used together with other asynchronized libraries.
64
+
Optional header-only configuration enabled with the PROMISE_HEADONLY macro
58
65
59
-
Promise-cpp can be the base component in event-looped asychronized programming, which is NOT std::promise.
66
+
Easy to use, just #include "promise-cpp/promise.hpp" is enough, code based on standard c++11 syntax, no external dependencies required.
67
+
68
+
Easy to integrate with other libararies (see examples of [asio](example/asio_timer.cpp), [qt](example/qt_timer) and [mfc](example/mfc_timer)).
69
+
70
+
Useful extended functions on promise object: doWhile, raceAndResolve, raceAndReject
60
71
61
72
## Examples
62
73
@@ -92,7 +103,25 @@ The library has passed test on these compilers --
92
103
93
104
* clang 3.4.2
94
105
95
-
### Build tips
106
+
### Usage
107
+
108
+
#### Used as header only library
109
+
110
+
To use as header only library, just define macro PROMISE_HEADONLY when compiling.
0 commit comments