MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / FilterGenerator

Method FilterGenerator

test/expected/catch.hpp:4112–4124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4110 public:
4111 template <typename P = Predicate>
4112 FilterGenerator(P&& pred, GeneratorWrapper<T>&& generator):
4113 m_generator(std::move(generator)),
4114 m_predicate(std::forward<P>(pred))
4115 {
4116 if (!m_predicate(m_generator.get())) {
4117 // It might happen that there are no values that pass the
4118 // filter. In that case we throw an exception.
4119 auto has_initial_value = next();
4120 if (!has_initial_value) {
4121 Catch::throw_exception(GeneratorException("No valid value found in filtered generator"));
4122 }
4123 }
4124 }
4125
4126 T const& get() const override {
4127 return m_generator.get();

Callers

nothing calls this directly

Calls 3

throw_exceptionFunction · 0.85
GeneratorExceptionClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected