Skip to content

binding of member functions of custom type #108

@assafcohen

Description

@assafcohen

hi,
I have a simple struct that has a data member that needs to be processed by a function when assigning it to tao::json::value.

struct my_type{
   std::string str_;
   int i_;
};
  std::string do_somthing_with_i_()
{
    return std::to_string(i_*i_);
}
template<>
struct
	tao::json::traits<my_type>
	: binding::object<

		TAO_JSON_BIND_REQUIRED("II", &do_somthing_with_i_),
		,TAO_JSON_BIND_REQUIRED("", &my_type::str_)>{};

what is the proper way to achieve this kind of behavior?
thank you for a fantastic library.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions