Chemical Descriptors Library: accumulate_atomic_prop_if
Atom Functors

accumulate_atomic_prop_if

Object type

Binary function

Description

The functor returns the sumation : prev + AtomProperty<PropSelector,Atom>::get(atom_), where prev and atom_ are parameters passed to the function iff the atom satisfies the predicate passed to the ctor of the functor.

Prototype

  template <class PropSelector, class Atom, class Predicate>
  struct accumulate_atomic_prop_if : public std::binary_function<
      typename AtomProperty<PropSelector,Atom>::result_type
    , Atom
    , typename AtomProperty<PropSelector,Atom>::result_type
  > {

    accumulate_atomic_prop_if(const Predicate& pred_) : ped(pred_)  {}

    typename boost::call_traits<result_type>::value_type
    operator () (typename boost::call_traits<first_argument_type>::param_type prev
      , typename boost::call_traits<second_argument_type>::param_type atom_) const;

  };

Associated types

type nameDescriptionmember type
result_type The type of the atomic property public
first_argument_type The atom type public
second_argument_type The type of the atomic property public

Definition

#include <morpho/cdl/atom/functors/atom_ftors.hpp>

Preconditions

PropSelector is a valid atomic property selector.
Predicate type is default constructible.

Complexity

Constant

Example



References



Copyright © Vladimir Josef Sykora & Morphochem AG 2003
Copyright © Vladimir Josef Sykora 2003-2006