| 4159 | public: |
| 4160 | template <typename P = Predicate> |
| 4161 | FilterGenerator(P&& pred, GeneratorWrapper<T>&& generator): |
| 4162 | m_generator(std::move(generator)), |
| 4163 | m_predicate(std::forward<P>(pred)) |
| 4164 | { |
| 4165 | if (!m_predicate(m_generator.get())) { |
| 4166 | // It might happen that there are no values that pass the |
| 4167 | // filter. In that case we throw an exception. |
| 4168 | auto has_initial_value = nextImpl(); |
| 4169 | if (!has_initial_value) { |
| 4170 | Catch::throw_exception(GeneratorException("No valid value found in filtered generator")); |
| 4171 | } |
| 4172 | } |
| 4173 | } |
| 4174 | |
| 4175 | T const& get() const override { |
| 4176 | return m_generator.get(); |
nothing calls this directly
no test coverage detected