diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-05-18 03:37:06 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-05-22 09:39:56 +0900 |
commit | bb26ca86ad350f2562b51284e7c631b1e4f77106 (patch) | |
tree | 8fe867870d8e8a8488ece979634035109e39e5eb /user.h | |
parent | ced7a66686596e74a1f25b5d9634b9b562870943 (diff) | |
download | libquotient-bb26ca86ad350f2562b51284e7c631b1e4f77106.tar.gz libquotient-bb26ca86ad350f2562b51284e7c631b1e4f77106.zip |
util.h: lookup() uses forwarding refs; added Dispatch/dispatch and REGISTER_ENUM
The Dispatch<> template and dispatch(), a facility function for it, simplify dispatching to functions that have different signatures that still can be converted to the same std::function<> type. The case in point is in event.cpp; Event::fromJson calls make() that always returns the type we need; however, once we have several possible base types (Event, RoomEvent, StateEvent), we'd have to either write a specific make() incarnation for each of them, or mess with function return type conversions. Dispatch<> helps to keep the code clean.
REGISTER_ENUM is a cross-Qt versions approach to dumping enumeration values to qDebug() and the likes.
Diffstat (limited to 'user.h')
0 files changed, 0 insertions, 0 deletions