Added libs/mpl
[SVN r15384]
This commit is contained in:
1 parent
6ec072c403
commit
01d61922bc
238 files changed
+15885
No files matched your search
@@ -0,0 +1,61 @@
|
||||
<!doctype html public "-//ietf//dtd html//en">
|
||||
<html><head><title>boost::mpl::Reference/count if</title>
|
||||
<link rel="stylesheet" href="../mpl_wiki.css">
|
||||
</head><body bgcolor="white">
|
||||
<h1><a href="../Table_of_Content.html"><img src="../mpl_logo.jpg" alt="[Home]" border=0 align="right"></a>count_if</h1><h3>Synopsis</h3>
|
||||
<p>
|
||||
<pre>
|
||||
template<
|
||||
typename Sequence
|
||||
, typename Pred
|
||||
>
|
||||
struct count_if
|
||||
{
|
||||
typedef <em>unspecified</em> type;
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
Returns the number of elements in a <code>Sequence</code> that satisfy the predicate <code>Pred</code>.
|
||||
<p>
|
||||
<h3>Definition</h3>
|
||||
<p>
|
||||
<pre>
|
||||
#include "<a href="../../../../../\boost/mpl/count_if.hpp">boost/mpl/count_if.hpp</a>"
|
||||
</pre>
|
||||
<p>
|
||||
<h3>Parameters</h3>
|
||||
<table border="1">
|
||||
<tr><th> Parameter </th><th> Requirement </th><th> Description </th></tr>
|
||||
<tr><td><code>Sequence</code></td><td>A model of <a href="../Forward_Sequence.html">Forward Sequence</a></td><td>A sequence to be examined. </td></tr>
|
||||
<tr><td><code>Pred</code></td><td>A model of Predicate [Lambda Expression]</td><td>The count condition. </td></tr>
|
||||
</table>
|
||||
<p>
|
||||
<h3>Expression semantics</h3>
|
||||
<p>
|
||||
<table border="1">
|
||||
<tr><th> Expression </th><th> Expression type </th><th> Precondition </th><th> Semantics </th><th> Postcondition </th></tr>
|
||||
<tr><td><code>typedef count_if<Sequence,Pred>::type n;</code></td><td>A model of <a href="../Integral_Constant.html">Integral Constant</a></td><td></td><td>Equivalent to <code> typedef lambda<Pred>::type pred; typedef <a href="../Reference/fold.html">fold</a>< Sequence,integral_c<unsigned long,0>,if_<pred,<a href="../Reference/next.html">next</a><_1>,_1> >::type n;</code></td><td></td></tr>
|
||||
</table>
|
||||
<p>
|
||||
<p>
|
||||
<h3>Complexity</h3>
|
||||
<p>
|
||||
Linear. Exactly <code><a href="../Reference/size.html">size</a><Sequence>::value</code> applications of <code>Pred</code>.
|
||||
<p>
|
||||
<h3>Example</h3>
|
||||
<p>
|
||||
<pre>
|
||||
typedef <a href="../Reference/list.html">list</a><int,char,long,short,char,long,double,long> types;
|
||||
<p>
|
||||
BOOST_STATIC_ASSERT((count_if< types,boost::is_float<_> >::type::value == 1));
|
||||
BOOST_STATIC_ASSERT((count_if< types,boost::is_same<_,char> >::type::value == 2));
|
||||
BOOST_STATIC_ASSERT((count_if< types,boost::is_same<_,void> >::type::value == 0));
|
||||
</pre>
|
||||
<p>
|
||||
<h3>See also</h3>
|
||||
<p>
|
||||
<a href="../Algorithms.html">Algorithms</a>, <code><a href="../Reference/count.html">count</a></code>, <code><a href="../Reference/find_if.html">find_if</a></code>, <code><a href="../Reference/find.html">find</a></code>, <code><a href="../Reference/contains.html">contains</a></code>
|
||||
<p><hr>
|
||||
<a href="../Table_of_Content.html">Table of Content</a> | <a href="../Reference.html">Reference</a><br>Last edited July 17, 2002 4:32 am</body></html>
|
||||
Reference in new issue
Block a user