| 121 | }; |
| 122 | |
| 123 | struct axes_appender { |
| 124 | bp::object obj; |
| 125 | pyhistogram::axes_type& axes; |
| 126 | bool& success; |
| 127 | axes_appender(bp::object o, pyhistogram::axes_type& a, bool& s) |
| 128 | : obj(o), axes(a), success(s) {} |
| 129 | template <typename A> |
| 130 | void operator()(const A&) const { |
| 131 | if (success) return; |
| 132 | bp::extract<const A&> get_axis(obj); |
| 133 | if (get_axis.check()) { |
| 134 | axes.emplace_back(get_axis()); |
| 135 | success = true; |
| 136 | } |
| 137 | } |
| 138 | }; |
| 139 | |
| 140 | bp::object histogram_axis(const pyhistogram& self, int i) { |
| 141 | if (i < 0) i += self.dim(); |