MCPcopy Create free account
hub / github.com/OpenArkStudio/ARK / FilterGenerator

Method FilterGenerator

test/catch.hpp:4783–4797  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4781public:
4782 template<typename P = Predicate>
4783 FilterGenerator(P&& pred, GeneratorWrapper<T>&& generator)
4784 : m_generator(std::move(generator))
4785 , m_predicate(std::forward<P>(pred))
4786 {
4787 if (!m_predicate(m_generator.get()))
4788 {
4789 // It might happen that there are no values that pass the
4790 // filter. In that case we throw an exception.
4791 auto has_initial_value = next();
4792 if (!has_initial_value)
4793 {
4794 Catch::throw_exception(GeneratorException("No valid value found in filtered generator"));
4795 }
4796 }
4797 }
4798
4799 T const& get() const override
4800 {

Callers

nothing calls this directly

Calls 3

throw_exceptionFunction · 0.85
GeneratorExceptionClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected