custom axis, which adapts builtin integer axis
| 7 | |
| 8 | // custom axis, which adapts builtin integer axis |
| 9 | struct custom_axis : public bh::axis::integer<> { |
| 10 | using value_type = const char*; // type that is fed to the axis |
| 11 | |
| 12 | using integer::integer; // inherit ctors of base |
| 13 | |
| 14 | // the customization point |
| 15 | // - accept const char* and convert to int |
| 16 | // - then call index method of base class |
| 17 | int index(value_type s) const { return integer::index(std::atoi(s)); } |
| 18 | }; |
| 19 | |
| 20 | int main() { |
| 21 | auto h = bh::make_static_histogram(custom_axis(0, 3)); |