I'm trying to declare a strongly-typed actor in C++ actor framework (CAF), but my code doesn't compile for some reason. Could you tell me what's wrong with it?
#include "caf/all.hpp"
template <typename TNum>
class DiscoverRequest {};
template <typename TNum>
class DiscoverResponse {};
template <typename TNum>
class DataRequest {};
template <typename TNum>
class DataResponse {};
template <typename TNum>
using BlockActor = caf::typed_actor<
/* ERROR NEXT LINE */
caf::replies_to<DiscoverRequest<TNum>>::with<DiscoverResponse<TNum>>,
caf::replies_to<DataRequest<TNum>> ::with<DataResponse<TNum>> >;
The error message:
Block.hh:13:71: error: type/value mismatch at argument 1 in template
parameter list for 'template<class ... Sigs> class caf::typed_actor'
caf::replies_to<DiscoverRequest<TNum>>::with<DiscoverResponse<TNum>>,
^
Block.hh:13:71: error: expected a type, got
'(caf::replies_to<DiscoverRequest<TNum> >::with < <expression error>)'
But if I replace DiscoverRequest<TNum> and DiscoverResponse<TNum> with specific instantiations, like, for example, DiscoverRequest<float>, it does compile nicely. So, I think something in CAF internals forbids using such a construct.
My compiler is GCC G++ 4.9.2 (with -std=c++11, of course), running on Fedora 21. The CAF is the latest revision of its master branch, linked to the project as a Git submodule.
Aucun commentaire:
Enregistrer un commentaire