Questions tagged [tag-invoke]

4 questions
12
votes
1 answer

Why does tag_invoke pattern need the Niebloid std::tag_invoke at all?

This question assumes familiarity with the customization point management technique tag_invoke, introduced in P1895R0. A customization point object can be defined according to P1895R0 as: inline constexpr struct foo_cpo { // simplified original…
Nick
  • 931
  • 6
  • 17
3
votes
1 answer

customisation point for alias to std types

Let's say I am writing some generic algorithm in lib namespace that calls a customisation point my_func. First attempt is using ADL for my_func one of the user wants to specialise my_func for his type, which is an alias to std type. Surely define it…
1
vote
1 answer

Boost Json conversion error for array of custom object

I'm trying to code a simple json to struct (and back) conversion by using tag_invoke overload of boost::json lib. Those are my structs: template void extract( boost::json::object const& obj, T& t, boost::json::string_view key ) { t =…
hirish
  • 188
  • 9
1
vote
1 answer

Class cannot serialize itself using boost::json

I wrote a tiny class which relies on boost::json to serialize itself. It fails to compile since compiler sounds to fail finding tag_invoke() functions which implement json::value<=>myClass translation : /usr/include/boost/json/value_from.hpp:87:35:…
sylwa06
  • 77
  • 10