mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 18:25:37 +08:00
Doxygen style.
This commit is contained in:
@@ -52,78 +52,58 @@ namespace BlackMisc
|
||||
using const_reference = typename std::iterator_traits<CIt>::reference;
|
||||
|
||||
public:
|
||||
/*!
|
||||
* Return a new container generated by applying some transformation function to all elements of this one.
|
||||
*/
|
||||
//! Return a new container generated by applying some transformation function to all elements of this one.
|
||||
template <class F>
|
||||
inline auto transform(F function) const
|
||||
-> CRange<Iterators::TransformIterator<CIt, F>>;
|
||||
|
||||
/*!
|
||||
* \brief Return a copy containing only those elements for which a given predicate returns true.
|
||||
*/
|
||||
//! Return a copy containing only those elements for which a given predicate returns true.
|
||||
template <class Predicate>
|
||||
inline auto findBy(Predicate p) const
|
||||
-> CRange<Iterators::ConditionalIterator<CIt, Predicate>>;
|
||||
|
||||
/*!
|
||||
* \brief Return a copy containing only those elements matching some particular key/value pair(s).
|
||||
* \param k0 A pointer to a member function of T.
|
||||
* \param v0 A value to compare against the value returned by k0.
|
||||
* \param keysValues Zero or more additional pairs of { pointer to member function of T, value to compare it against }.
|
||||
*/
|
||||
//! Return a copy containing only those elements matching some particular key/value pair(s).
|
||||
//! \param k0 A pointer to a member function of T.
|
||||
//! \param v0 A value to compare against the value returned by k0.
|
||||
//! \param keysValues Zero or more additional pairs of { pointer to member function of T, value to compare it against }.
|
||||
template <class K0, class V0, class... KeysValues>
|
||||
inline auto findBy(K0 k0, V0 v0, KeysValues... keysValues) const
|
||||
-> CRange<Iterators::ConditionalIterator<CIt, decltype(BlackMisc::Predicates::MemberEqual(k0, v0, keysValues...))>>;
|
||||
|
||||
/*!
|
||||
* Return a reference to the first element for which a given predicate returns true. Undefined if there is none.
|
||||
*/
|
||||
//! Return a reference to the first element for which a given predicate returns true. Undefined if there is none.
|
||||
template <class Predicate>
|
||||
const_reference findFirstBy(Predicate p) const { return findBy(p).front(); }
|
||||
|
||||
/*!
|
||||
* Return a reference to the first element matching some particular key/value pair(s). Undefined if there is none.
|
||||
*/
|
||||
//! Return a reference to the first element matching some particular key/value pair(s). Undefined if there is none.
|
||||
template <class K, class V>
|
||||
const_reference findFirstBy(K key, V value) const { return findBy(key, value).front(); }
|
||||
|
||||
/*!
|
||||
* Return a copy of the first element for which a given predicate returns true, or a default value if there is none.
|
||||
*/
|
||||
//! Return a copy of the first element for which a given predicate returns true, or a default value if there is none.
|
||||
template <class Predicate>
|
||||
value_type findFirstByOrDefault(Predicate p, const value_type &def = value_type{}) const { return findBy(p).frontOrDefault(def); }
|
||||
|
||||
/*!
|
||||
* Return a copy of the first element matching some particular key/value pair(s), or a default value if there is none.
|
||||
*/
|
||||
//! Return a copy of the first element matching some particular key/value pair(s), or a default value if there is none.
|
||||
template <class K, class V>
|
||||
value_type findFirstByOrDefault(K key, V value, const value_type &def = value_type{}) const { return findBy(key, value).frontOrDefault(def); }
|
||||
|
||||
/*!
|
||||
* \brief Return true if there is an element for which a given predicate returns true.
|
||||
*/
|
||||
//! Return true if there is an element for which a given predicate returns true.
|
||||
template <class Predicate>
|
||||
bool containsBy(Predicate p) const
|
||||
{
|
||||
return std::any_of(derived().cbegin(), derived().cend(), p);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Return true if there is an element equal to given object. Uses the most efficient implementation available in the derived container.
|
||||
*/
|
||||
//! Return true if there is an element equal to given object. Uses the most efficient implementation available in the derived container.
|
||||
template <class T>
|
||||
bool contains(const T &object) const
|
||||
{
|
||||
return derived().find(object) != derived().cend();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Return a copy containing only those elements matching some particular key/value pair(s).
|
||||
* \param k0 A pointer to a member function of T.
|
||||
* \param v0 A value to compare against the value returned by k0.
|
||||
* \param keysValues Zero or more additional pairs of { pointer to member function of T, value to compare it against }.
|
||||
*/
|
||||
//! Return a copy containing only those elements matching some particular key/value pair(s).
|
||||
//! \param k0 A pointer to a member function of T.
|
||||
//! \param v0 A value to compare against the value returned by k0.
|
||||
//! \param keysValues Zero or more additional pairs of { pointer to member function of T, value to compare it against }.
|
||||
template <class K0, class V0, class... KeysValues>
|
||||
bool contains(K0 k0, V0 v0, KeysValues... keysValues) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user