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