1.. Metafunctions/Arithmetic Operations//plus |10 2 3plus 4==== 5 6Synopsis 7-------- 8 9.. parsed-literal:: 10 11 template< 12 typename T1 13 , typename T2 14 , typename T3 = |unspecified| 15 |...| 16 , typename T\ *n* = |unspecified| 17 > 18 struct plus 19 { 20 typedef |unspecified| type; 21 }; 22 23 24 25Description 26----------- 27 28Returns the sum of its arguments. 29 30 31Header 32------ 33 34.. parsed-literal:: 35 36 #include <boost/mpl/plus.hpp> 37 #include <boost/mpl/arithmetic.hpp> 38 39 40Model of 41-------- 42 43|Numeric Metafunction| 44 45 46 47Parameters 48---------- 49 50+---------------+---------------------------+-----------------------------------------------+ 51| Parameter | Requirement | Description | 52+===============+===========================+===============================================+ 53| |T1...Tn| | |Integral Constant| | Operation's arguments. | 54+---------------+---------------------------+-----------------------------------------------+ 55 56|Note:| |numeric metafunction note| |-- end note| 57 58 59Expression semantics 60-------------------- 61 62For any |Integral Constant|\ s |c1...cn|: 63 64 65.. parsed-literal:: 66 67 typedef plus<c1,\ |...|\ c\ *n*\>::type r; 68 69:Return type: 70 |Integral Constant|. 71 72:Semantics: 73 Equivalent to 74 75 .. parsed-literal:: 76 77 typedef integral_c< 78 typeof(c1::value + c2::value) 79 , ( c1::value + c2::value ) 80 > c; 81 82 typedef plus<c,c3,\ |...|\c\ *n*\>::type r; 83 84.. .......................................................................... 85 86.. parsed-literal:: 87 88 typedef plus<c1,\ |...|\ c\ *n*\> r; 89 90:Return type: 91 |Integral Constant|. 92 93:Semantics: 94 Equivalent to 95 96 .. parsed-literal:: 97 98 struct r : plus<c1,\ |...|\ c\ *n*\>::type {}; 99 100 101 102 103Complexity 104---------- 105 106Amortized constant time. 107 108 109Example 110------- 111 112.. parsed-literal:: 113 114 typedef plus< int_<-10>, int_<3>, long_<1> >::type r; 115 BOOST_MPL_ASSERT_RELATION( r::value, ==, -6 ); 116 BOOST_MPL_ASSERT(( is_same< r::value_type, long > )); 117 118 119See also 120-------- 121 122|Arithmetic Operations|, |Numeric Metafunction|, |numeric_cast|, |minus|, |negate|, |times| 123 124 125.. copyright:: Copyright � 2001-2009 Aleksey Gurtovoy and David Abrahams 126 Distributed under the Boost Software License, Version 1.0. (See accompanying 127 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 128