nw::sum_effects_of

template<typename T, typename It, typename Extractor = decltype(&effect_extract_int0), typename Comp = std::greater<T>>
std::pair<T, It> nw::sum_effects_of(It begin, It end, nw::EffectType type, int subtype, Versus vs = {}, Extractor extractor = &effect_extract_int0, Comp comparator = std::greater<T>{}) noexcept

Finds all applicable effects of a given type / subtype.

Applicable effects are passed to a user supplied callback.

Template Parameters:
  • T – An arbitrary type that can be held in an effect, e.g. a simple integer, a damage roll, etc.

  • It – An iterator type

  • Extractor – A function that extracts a value of type T from an EffectHandle

  • Comp – A comparator taking two T values and returns true if the first is greater (Default std::greater<T>)

Parameters:
  • begin – Start of a range of effect handles of a type/subtype

  • end – End range of effect handles

  • type – An effect_type_* constant

  • subtype – A effect subtype, if no subtype -1 should be passed

  • vsVersus struct

  • extractor – A function that extracts the value from a particular effect.

  • comparator – A function taking two T values and returns true if the first is greater (Default std::greater<T>)

Returns:

(result, iterator)