Chemical Descriptors Library: accumulate_atoms
Molecule Functors

accumulate_atoms

Object type

Unary functor

Description

accumulate_atoms applies std::accumulate() algorithm to the atoms range of the molecule. The binary function to apply is a template parameter of the unary function.

Prototype

  template <class Molecule, class BinaryOperation>
  struct accumulate_atoms : public std::unary_function<Molecule
                          , typename BinaryOperation::result_type> {

    accumulate_atoms(const result_type init_, const BinaryOperation& bop_) :  init(init_), bop(bop_) {}
    accumulate_atoms(const result_type init_) : init(init_), bop(BinaryOperation()) {}
    accumulate_atoms(const BinaryOperation& bop_) : init(result_type()), bop(bop_) {}
    accumulate_atoms() : init(result_type()), bop(BinaryOperation()) {}

    result_type
    operator ()(typename boost::call_traits<argument_type>::param_type m) const;


  };

Associated types

type nameDescriptionmember type
argument_type The type of the unary function's argument, usually the type of a molecule public
result_type The type of the return type of the binary operation to be applied to each atom. Also, the type returned by the functor public

Definition

#include <morpho/cdl/molecule/functors/mol_ftors.hpp>

Preconditions

The BinaryOperation accepts a result_type and an atom. It is called with the following signature: binary_op(result, *atom_iterator).

Complexity

Linear: num_atoms() applications of the BinaryOperation.

Example



References



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