variant visitor using SFINAE problem
Hi, attached my code to show my problem. It seems to work (partially) so far, but not the vector<int> where I get a compile error. This is my first try with SFINAE in that way. Are the conditions correct and robust enough? How to compile it? Did I forgot one use case? Using this small helper would simplify some post processing. Thanks, Olaf
attached my code to show my problem. It seems to work (partially) so far, but not the vector<int> where I get a compile error. This is my first try with SFINAE in that way. Are the conditions correct and robust enough? How to compile it? Did I forgot one use case? Using this small helper would simplify some post processing.
What visit() overload did you intend to call for vector<int>? Note that enable_if condition: mpl::and_< boost::has_range_const_iterator<VisitableT>, boost::is_void<typename VisitorT::result_type> >, seems to be fulfilled for vector<int> case, doesn't it? But it's obviously not the right overload, as int is not variant.
attached my code to show my problem. It seems to work (partially) so far, but not the vector<int> where I get a compile error. This is my first try with SFINAE in that way. Are the conditions correct and robust enough? How to compile it? Did I forgot one use case? Using this small helper would simplify some post processing.
What visit() overload did you intend to call for vector<int>? Note that enable_if condition: mpl::and_< boost::has_range_const_iterator<VisitableT>, boost::is_void<typename VisitorT::result_type> >,
seems to be fulfilled for vector<int> case, doesn't it? But it's obviously not the right overload, as int is not variant.
thank you, you did point out it; unfortunately, my extension doesn't compile. Thanks, Olaf
What visit() overload did you intend to call for vector<int>? Note that enable_if condition: mpl::and_< boost::has_range_const_iterator<VisitableT>, boost::is_void<typename VisitorT::result_type> >,
seems to be fulfilled for vector<int> case, doesn't it? But it's obviously not the right overload, as int is not variant.
thank you, you did point out it; unfortunately, my extension doesn't compile.
Because you actually should apply is_variant metafunction to the
value_type of the container, not to the container itself:
mpl::not_
Am 26.05.2013 15:20, schrieb Igor R:
What visit() overload did you intend to call for vector<int>? Note that enable_if condition: mpl::and_< boost::has_range_const_iterator<VisitableT>, boost::is_void<typename VisitorT::result_type> >,
seems to be fulfilled for vector<int> case, doesn't it? But it's obviously not the right overload, as int is not variant.
thank you, you did point out it; unfortunately, my extension doesn't compile.
Because you actually should apply is_variant metafunction to the value_type of the container, not to the container itself: mpl::not_
, <....> is_variant<typename VisitableT::value_type>,
Now, I've got it; thanks a lot Igor!
participants (2)
-
Igor R
-
Olaf Peter