Akonadi

Akonadi::Server::_detail::ById< Op > Struct Template Reference

#include <entity.h>

Public Types

using result_type = bool
 

Public Member Functions

template<typename E >
bool operator() (const E &lhs, const E &rhs) const
 
template<typename E >
bool operator() (const E &lhs, Entity::Id rhs) const
 
template<typename E >
bool operator() (Entity::Id lhs, const E &rhs) const
 
bool operator() (Entity::Id lhs, Entity::Id rhs) const
 

Detailed Description

template<template< typename U > class Op>
struct Akonadi::Server::_detail::ById< Op >

Binary predicate to sort collections of Entity subclasses by their id.

Example for sorting:

std::sort( coll.begin(), coll.end(), _detail::ById<std::less>() );

Example for finding by id:

// linear:
std::find_if( coll.begin(), coll.end(), bind( _detail::ById<std::equal_to>(), _1, myId ) );
// binary:
std::lower_bound( coll.begin(), coll.end(), myId, _detail::ById<std::less>() );

Definition at line 145 of file entity.h.


The documentation for this struct was generated from the following file:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Aug 15 2022 03:57:45 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.