Add support for describe getters && setters
- Dominant language
- C++
- Stars
- 78
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
I suggest adding support for getters and setters to the library. I see this new functionality like this:
```
#include
#include
struct employee
{
void set_name (std::string name) ;
void set_age (int age) ;
const std::string& get_name () const ;
int get_age () const ;
};
BOOST_DESCRIBE_STRUCT(
employee, (), (
("name", get_name, set_name),
("age", get_age, set_age)))
int main()
{
using boost::describe::describe_members;
using boost::describe::mod_any_access;
employee emp;
emp.set_name("John");
emp.set_age(20);
boost::mp11::mp_for_each>([&](auto D){
auto getter = D.getter; // D also have "setter" field, but a "pointer" field is unavailable
std::cout << D.name << " = " << (emp.*getter)() << std::endl;
});
// Will print:
// name = John
// age = 20
return 0;
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.