Chemical Descriptors Library: num_atoms
Molecule Functors

num_atoms

Object type

Unary functor

Description

This functor counts the number of atoms that satisfy an unary predicate which in turn is a template paramenter of the functor. The unary predicate accepts an user-defined property of the atom.

Prototype

  template <class Molecule, class PropertySelector, class UnaryPredicate>
  struct num_atoms : public std::unary_function <Molecule
                          , typename Molecule::vertices_size_type> {

    num_atoms (const UnaryPredicate& up = UnaryPredicate()) : unary_pred(up) {}

    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 return type of the ftor. Specifically: typename Molecule::vertices_size_type public

Definition

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

Preconditions

UnaryPredicate accepts the type of the return type of AtomProperty<PropertySelector, typename Molecule::atom_type>::get() and returns a bool. Also, PropertySelector is a valid atomic property selector.

Complexity

Linear: O(num_atoms())

Example



References



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