Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / math / doc / html / math_toolkit / lcm_function_object.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>LCM Function Object</title>
5 <link rel="stylesheet" href="../math.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../index.html" title="Math Toolkit 2.5.2">
8 <link rel="up" href="../gcd_lcm.html" title="Chapter&#160;11.&#160;Integer Utilities (Greatest Common Divisor and Least Common Multiple)">
9 <link rel="prev" href="gcd_function_object.html" title="GCD Function Object">
10 <link rel="next" href="run_time.html" title="Run-time GCD &amp; LCM Determination">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="gcd_function_object.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../gcd_lcm.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="run_time.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
27 <a name="math_toolkit.lcm_function_object"></a><a class="link" href="lcm_function_object.html" title="LCM Function Object">LCM Function Object</a>
28 </h2></div></div></div>
29 <p>
30       <span class="bold"><strong>Header: </strong></span> <a href="../../../../../boost/math/common_factor_rt.hpp" target="_top">&lt;boost/math/common_factor_rt.hpp&gt;</a>
31     </p>
32 <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">IntegerType</span> <span class="special">&gt;</span>
33 <span class="keyword">class</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">lcm_evaluator</span>
34 <span class="special">{</span>
35 <span class="keyword">public</span><span class="special">:</span>
36    <span class="comment">// Types</span>
37    <span class="keyword">typedef</span> <span class="identifier">IntegerType</span>  <span class="identifier">result_type</span><span class="special">;</span>
38    <span class="keyword">typedef</span> <span class="identifier">IntegerType</span>  <span class="identifier">first_argument_type</span><span class="special">;</span>
39    <span class="keyword">typedef</span> <span class="identifier">IntegerType</span>  <span class="identifier">second_argument_type</span><span class="special">;</span>
40
41    <span class="comment">// Function object interface</span>
42    <span class="identifier">result_type</span>  <span class="keyword">operator</span> <span class="special">()(</span> <span class="identifier">first_argument_type</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="identifier">a</span><span class="special">,</span>
43    <span class="identifier">second_argument_type</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="identifier">b</span> <span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
44 <span class="special">};</span>
45 </pre>
46 <p>
47       The <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">lcm_evaluator</span></code>
48       class template defines a function object class to return the least common multiple
49       of two integers. The template is parameterized by a single type, called <code class="computeroutput"><span class="identifier">IntegerType</span> </code>here. This type should be a numeric
50       type that represents integers. The result of the function object is always
51       nonnegative, even if either of the operator arguments is negative. If the least
52       common multiple is beyond the range of the integer type, the results are undefined.
53     </p>
54 <p>
55       This function object class template is used in the corresponding version of
56       the LCM function template. If a numeric type wants to customize evaluations
57       of its least common multiples, then the type should specialize on the <code class="computeroutput"><span class="identifier">lcm_evaluator</span></code> class template.
58     </p>
59 </div>
60 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
61 <td align="left"></td>
62 <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
63       Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
64       Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
65       Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
66         Distributed under the Boost Software License, Version 1.0. (See accompanying
67         file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
68       </p>
69 </div></td>
70 </tr></table>
71 <hr>
72 <div class="spirit-nav">
73 <a accesskey="p" href="gcd_function_object.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../gcd_lcm.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="run_time.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
74 </div>
75 </body>
76 </html>