1 2The MPL includes a number of predefined metafunctions that can be roughly 3classified in two categories: `general purpose metafunctions`, dealing with 4conditional |type selection| and higher-order metafunction |invocation|, 5|composition|, and |argument binding|, and `numeric metafunctions`, 6incapsulating built-in and user-defined |arithmetic|, |comparison|, 7|logical|, and |bitwise| operations. 8 9Given that it is possible to perform integer numeric computations at 10compile time using the conventional operators notation, the need for the 11second category might be not obvious, but it in fact plays a cental role in 12making programming with MPL seemingly effortless. In 13particular, there are at least two contexts where built-in language 14facilities fall short [#portability]_\ : 15 161) Passing a computation to an algorithm. 172) Performing a computation on non-integer data. 18 19The second use case deserves special attention. In contrast to the built-in, 20strictly integer compile-time arithmetics, the MPL numeric metafunctions are 21*polymorphic*, with support for *mixed-type arithmetics*. This means that they 22can operate on a variety of numeric types |--| for instance, rational, 23fixed-point or complex numbers, |--| and that, in general, you are allowed to 24freely intermix these types within a single expression. See |Numeric 25Metafunction| concept for more details on the MPL numeric infrastructure. 26 27.. The provided `infrastructure`__ allows easy plugging of user-defined numeric 28 types 29 Naturally, they also , meaning that you can perform a computation on the 30 arguments of different types, and the result will yeild the largest/most general 31 of them. For user-defined numeric types, they provide an `infrastructure`__ that 32 allows easy plugging and seemless integration with predefined library 33 types. details. 34 35 __ `Numeric Metafunction`_ 36 37 38To reduce a negative syntactical impact of the metafunctions notation 39over the infix operator notation, all numeric metafunctions 40allow to pass up to N arguments, where N is defined by the value of 41|BOOST_MPL_LIMIT_METAFUNCTION_ARITY| configuration macro. 42 43 44.. [#portability] All other considerations aside, as of the time of this writing 45 (early 2004), using built-in operators on integral constants still often 46 present a portability problem |--| many compilers cannot handle particular 47 forms of expressions, forcing us to use conditional compilation. Because MPL 48 numeric metafunctions work on types and encapsulate these kind of workarounds 49 internally, they elude these problems, so if you aim for portability, it is 50 generally adviced to use them in the place of the conventional operators, even 51 at the price of slightly decreased readability. 52 53 54.. copyright:: Copyright � 2001-2009 Aleksey Gurtovoy and David Abrahams 55 Distributed under the Boost Software License, Version 1.0. (See accompanying 56 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 57