added compile time check to cnm for the validity of the supplied policy
This commit is contained in:
parent
66c758f13a
commit
f6fb183649
@ -6,6 +6,7 @@
|
||||
#include <boost/asio.hpp>
|
||||
#include <algorithm>
|
||||
#include "chat_messages.hpp"
|
||||
#include "check_policy.hpp"
|
||||
|
||||
|
||||
|
||||
@ -19,21 +20,23 @@ namespace chat
|
||||
struct receive_policy_stdout
|
||||
{
|
||||
static void message_do_what(chat_message msg)
|
||||
{
|
||||
std::cout << msg << '\n';
|
||||
}
|
||||
{ std::cout << msg << '\n'; }
|
||||
|
||||
// TODO: handshake_policy
|
||||
};
|
||||
|
||||
|
||||
/* most ezt így üres template paraméterekkel kell példányosítani,
|
||||
* már amennyiben nem akarunk valami custom receive policyt megadni,
|
||||
* pl.: client_network_manager<> cnm;
|
||||
* meg lehet oldani úgy, hogy ne kelljen? usingot/typedefet nem enged saját magára */
|
||||
template <class receive_policy = receive_policy_stdout>
|
||||
class client_network_manager
|
||||
{
|
||||
// TODO: add static assert to check receive_policy
|
||||
/* compile-time check for whether receive_policy is valid or not */
|
||||
static_assert(is_valid_policy<receive_policy>::value,
|
||||
"Receive policy does not supply neccessary methods!");
|
||||
|
||||
/* members */
|
||||
private:
|
||||
asio::io_service& _ios;
|
||||
|
Loading…
Reference in New Issue
Block a user