Chemical Descriptors Library: num_bonds
|
Molecule Functors
|
|
num_bonds
Object type
Unary functor
Description
This functor counts the number of bonds 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 bond.
Prototype
template <class Molecule, class PropertySelector, class UnaryPredicate>
struct num_bonds : public std::unary_function <Molecule
, unsigned> {
num_bonds (const UnaryPredicate& up = UnaryPredicate()) : unary_pred(up) {}
result_type
operator ()(typename boost::call_traits<argument_type>::param_type m) const;
};
Associated types
type name | Description | member 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 unsigned |
public |
Definition
#include <morpho/cdl/molecule/functors/mol_ftors.hpp>
Preconditions
UnaryPredicate accepts the type of the return type of
BondProperty<PropertySelector, typename Molecule::bond_type>::get()
and returns a bool.
Also, PropertySelector is a valid bond property selector.
Complexity
Linear: O(num_bonds())
Example
References
Copyright © Vladimir Josef Sykora & Morphochem AG 2003
Copyright © Vladimir Josef Sykora 2003-2006