2017-03-14 22:57:07 +02:00
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=US-ASCII" >
< title > Chapter  1.  Boost.Mp11< / title >
< link rel = "stylesheet" href = "../../../../doc/src/boostbook.css" type = "text/css" >
< meta name = "generator" content = "DocBook XSL Stylesheets V1.78.1" >
< link rel = "home" href = "mp11.html" title = "Chapter 1. Boost.Mp11" >
< / head >
< body bgcolor = "white" text = "black" link = "#0000FF" vlink = "#840084" alink = "#0000FF" >
< table cellpadding = "2" width = "100%" > < tr >
< td valign = "top" > < img alt = "Boost C++ Libraries" width = "277" height = "86" src = "../../../../boost.png" > < / td >
< td align = "center" > < a href = "../../../../index.html" > Home< / a > < / td >
< td align = "center" > < a href = "../../../../libs/libraries.htm" > Libraries< / a > < / td >
< td align = "center" > < a href = "http://www.boost.org/users/people.html" > People< / a > < / td >
< td align = "center" > < a href = "http://www.boost.org/users/faq.html" > FAQ< / a > < / td >
< td align = "center" > < a href = "../../../../more/index.htm" > More< / a > < / td >
< / tr > < / table >
< hr >
< div class = "spirit-nav" > < / div >
< div class = "chapter" >
< div class = "titlepage" > < div >
< div > < h2 class = "title" >
< a name = "mp11" > < / a > Chapter  1.  Boost.Mp11< / h2 > < / div >
< div > < p class = "copyright" > Copyright © 2015-2017 Peter Dimov< / p > < / div >
< div > < div class = "legalnotice" >
< a name = "mp11.legal" > < / a > < p >
Distributed under the < a href = "http://boost.org/LICENSE_1_0.txt" target = "_top" > Boost
Software License, Version 1.0< / a > .
< / p >
< / div > < / div >
< / div > < / div >
< div class = "toc" >
< p > < b > Table of Contents< / b > < / p >
< dl class = "toc" >
< dt > < span class = "section" > < a href = "mp11.html#mp11.overview" > Overview< / a > < / span > < / dt >
2017-03-17 05:55:27 +02:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.definitions" > Definitions< / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.examples" > Examples< / a > < / span > < / dt >
< dd > < dl >
< dt > < span class = "section" > < a href = "mp11.html#mp11.examples.generating_test_cases" > Generating Test
Cases< / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.examples.computing_return_types" > Computing Return
Types< / a > < / span > < / dt >
< / dl > < / dd >
2017-03-14 22:57:07 +02:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference" > Reference< / a > < / span > < / dt >
< dd > < dl >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.integral" > Integral Constants, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > /< / span > < span class = "identifier" > integral< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dd > < dl >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.integral.mp_bool_b" > < code class = "computeroutput" > < span class = "identifier" > mp_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > B< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.integral.mp_true" > < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.integral.mp_false" > < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.integral.mp_to_bool_t" > < code class = "computeroutput" > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.integral.mp_not_t" > < code class = "computeroutput" > < span class = "identifier" > mp_not< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.integral.mp_int_i" > < code class = "computeroutput" > < span class = "identifier" > mp_int< / span > < span class = "special" > < < / span > < span class = "identifier" > I< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.integral.mp_size_t_n" > < code class = "computeroutput" > < span class = "identifier" > mp_size_t< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< / dl > < / dd >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list" > List Operations, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > /< / span > < span class = "identifier" > list< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dd > < dl >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_list_t" > < code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_size_l" > < code class = "computeroutput" > < span class = "identifier" > mp_size< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_empty_l" > < code class = "computeroutput" > < span class = "identifier" > mp_empty< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_front_l" > < code class = "computeroutput" > < span class = "identifier" > mp_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_pop_front_l" > < code class = "computeroutput" > < span class = "identifier" > mp_pop_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_first_l" > < code class = "computeroutput" > < span class = "identifier" > mp_first< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_rest_l" > < code class = "computeroutput" > < span class = "identifier" > mp_rest< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_second_l" > < code class = "computeroutput" > < span class = "identifier" > mp_second< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_third_l" > < code class = "computeroutput" > < span class = "identifier" > mp_third< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_push_front_l_t" > < code class = "computeroutput" > < span class = "identifier" > mp_push_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_push_back_l_t" > < code class = "computeroutput" > < span class = "identifier" > mp_push_back< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_rename_l_y" > < code class = "computeroutput" > < span class = "identifier" > mp_rename< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span >
< span class = "identifier" > Y< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
2017-03-24 14:26:31 +02:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_apply_f_l" > < code class = "computeroutput" > < span class = "identifier" > mp_apply< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span >
< span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
2017-03-14 22:57:07 +02:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_append_l" > < code class = "computeroutput" > < span class = "identifier" > mp_append< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
2017-03-18 20:36:58 +02:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_replace_front_l_t" > < code class = "computeroutput" > < span class = "identifier" > mp_replace_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_replace_first_l_t" > < code class = "computeroutput" > < span class = "identifier" > mp_replace_first< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_replace_second_l_t" > < code class = "computeroutput" > < span class = "identifier" > mp_replace_second< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_replace_third_l_t" > < code class = "computeroutput" > < span class = "identifier" > mp_replace_third< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
2017-03-14 22:57:07 +02:00
< / dl > < / dd >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility" > Utility Components, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > /< / span > < span class = "identifier" > utility< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dd > < dl >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility.mp_identity_t" > < code class = "computeroutput" > < span class = "identifier" > mp_identity< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility.mp_identity_t_t" > < code class = "computeroutput" > < span class = "identifier" > mp_identity_t< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility.mp_inherit_t" > < code class = "computeroutput" > < span class = "identifier" > mp_inherit< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility.mp_if_c_b_t_e" > < code class = "computeroutput" > < span class = "identifier" > mp_if_c< / span > < span class = "special" > < < / span > < span class = "identifier" > B< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > E< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility.mp_if_c_t_e" > < code class = "computeroutput" > < span class = "identifier" > mp_if< / span > < span class = "special" > < < / span > < span class = "identifier" > C< / span > < span class = "special" > ,< / span >
< span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > E< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility.mp_eval_if_c_b_t_f_u" > < code class = "computeroutput" > < span class = "identifier" > mp_eval_if_c< / span > < span class = "special" > < < / span > < span class = "identifier" > B< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span >
< span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility.mp_eval_if_c_t_f_u" > < code class = "computeroutput" > < span class = "identifier" > mp_eval_if< / span > < span class = "special" > < < / span > < span class = "identifier" > C< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span >
< span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility.mp_valid_f_t" > < code class = "computeroutput" > < span class = "identifier" > mp_valid< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility.mp_defer_f_t" > < code class = "computeroutput" > < span class = "identifier" > mp_defer< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
2017-03-15 18:09:30 +02:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility.mp_quote_f_t" > < code class = "computeroutput" > < span class = "identifier" > mp_quote< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
2017-03-17 01:39:52 +02:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility.mp_invoke_q_t" > < code class = "computeroutput" > < span class = "identifier" > mp_invoke< / span > < span class = "special" > < < / span > < span class = "identifier" > Q< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
2017-03-14 22:57:07 +02:00
< / dl > < / dd >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm" > Algorithms, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > /< / span > < span class = "identifier" > algorithm< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dd > < dl >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_assign_l1_l2" > < code class = "computeroutput" > < span class = "identifier" > mp_assign< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / span > < span class = "special" > ,< / span > < span class = "identifier" > L2< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_clear_l" > < code class = "computeroutput" > < span class = "identifier" > mp_clear< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_transform_f_l" > < code class = "computeroutput" > < span class = "identifier" > mp_transform< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > L< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
2017-03-18 20:36:58 +02:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_transform_if_p_f_l" > < code class = "computeroutput" > < span class = "identifier" > mp_transform_if< / span > < span class = "special" > < < / span > < span class = "identifier" > P< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > L< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
2017-03-14 22:57:07 +02:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_fill_l_v" > < code class = "computeroutput" > < span class = "identifier" > mp_fill< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_count_l_v" > < code class = "computeroutput" > < span class = "identifier" > mp_count< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_count_if_l_p" > < code class = "computeroutput" > < span class = "identifier" > mp_count_if< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_contains_l_v" > < code class = "computeroutput" > < span class = "identifier" > mp_contains< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_repeat_c_l_n" > < code class = "computeroutput" > < span class = "identifier" > mp_repeat_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_repeat_l_n" > < code class = "computeroutput" > < span class = "identifier" > mp_repeat< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_product_f_l" > < code class = "computeroutput" > < span class = "identifier" > mp_product< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > L< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_drop_c_l_n" > < code class = "computeroutput" > < span class = "identifier" > mp_drop_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_drop_l_n" > < code class = "computeroutput" > < span class = "identifier" > mp_drop< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
2017-03-15 19:43:06 +02:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_iota_c_n" > < code class = "computeroutput" > < span class = "identifier" > mp_iota_c< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_iota_n" > < code class = "computeroutput" > < span class = "identifier" > mp_iota< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
2017-03-14 22:57:07 +02:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_at_c_l_i" > < code class = "computeroutput" > < span class = "identifier" > mp_at_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > I< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_at_l_i" > < code class = "computeroutput" > < span class = "identifier" > mp_at< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span >
< span class = "identifier" > I< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_take_c_l_n" > < code class = "computeroutput" > < span class = "identifier" > mp_take_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_take_l_n" > < code class = "computeroutput" > < span class = "identifier" > mp_take< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_replace_l_v_w" > < code class = "computeroutput" > < span class = "identifier" > mp_replace< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > ,< / span > < span class = "identifier" > W< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_replace_if_l_p_w" > < code class = "computeroutput" > < span class = "identifier" > mp_replace_if< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > ,< / span > < span class = "identifier" > W< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
2017-03-18 20:36:58 +02:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_replace_at_c_l_i_w" > < code class = "computeroutput" > < span class = "identifier" > mp_replace_at_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > I< / span > < span class = "special" > ,< / span > < span class = "identifier" > W< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_replace_at_l_i_w" > < code class = "computeroutput" > < span class = "identifier" > mp_replace_at< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > I< / span > < span class = "special" > ,< / span > < span class = "identifier" > W< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
2017-03-14 22:57:07 +02:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_copy_if_l_p" > < code class = "computeroutput" > < span class = "identifier" > mp_copy_if< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_remove_l_v" > < code class = "computeroutput" > < span class = "identifier" > mp_remove< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_remove_if_l_p" > < code class = "computeroutput" > < span class = "identifier" > mp_remove_if< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_partition_l_p" > < code class = "computeroutput" > < span class = "identifier" > mp_partition< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_sort_l_p" > < code class = "computeroutput" > < span class = "identifier" > mp_sort< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_find_l_v" > < code class = "computeroutput" > < span class = "identifier" > mp_find< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_find_if_l_p" > < code class = "computeroutput" > < span class = "identifier" > mp_find_if< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_reverse_l" > < code class = "computeroutput" > < span class = "identifier" > mp_reverse< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_fold_l_v_f" > < code class = "computeroutput" > < span class = "identifier" > mp_fold< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_reverse_fold_l_v_f" > < code class = "computeroutput" > < span class = "identifier" > mp_reverse_fold< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_unique_l" > < code class = "computeroutput" > < span class = "identifier" > mp_unique< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_all_of_l_p" > < code class = "computeroutput" > < span class = "identifier" > mp_all_of< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_none_of_l_p" > < code class = "computeroutput" > < span class = "identifier" > mp_none_of< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_any_of_l_p" > < code class = "computeroutput" > < span class = "identifier" > mp_any_of< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< / dl > < / dd >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.set" > Set Operations, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > /< / span > < span class = "identifier" > set< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dd > < dl >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.set.mp_set_contains_s_v" > < code class = "computeroutput" > < span class = "identifier" > mp_set_contains< / span > < span class = "special" > < < / span > < span class = "identifier" > S< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.set.mp_set_push_back_s_t" > < code class = "computeroutput" > < span class = "identifier" > mp_set_push_back< / span > < span class = "special" > < < / span > < span class = "identifier" > S< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.set.mp_set_push_front_s_t" > < code class = "computeroutput" > < span class = "identifier" > mp_set_push_front< / span > < span class = "special" > < < / span > < span class = "identifier" > S< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< / dl > < / dd >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.map" > Map Operations, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > /< / span > < span class = "identifier" > map< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dd > < dl >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.map.mp_map_find_m_k" > < code class = "computeroutput" > < span class = "identifier" > mp_map_find< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span >
< span class = "identifier" > K< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.map.mp_map_contains_m_k" > < code class = "computeroutput" > < span class = "identifier" > mp_map_contains< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > K< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.map.mp_map_insert_m_t" > < code class = "computeroutput" > < span class = "identifier" > mp_map_insert< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.map.mp_map_replace_m_t" > < code class = "computeroutput" > < span class = "identifier" > mp_map_replace< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.map.mp_map_update_m_t_f" > < code class = "computeroutput" > < span class = "identifier" > mp_map_update< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.map.mp_map_erase_m_k" > < code class = "computeroutput" > < span class = "identifier" > mp_map_erase< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > K< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< / dl > < / dd >
2017-03-16 19:45:47 +02:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.function" > Helper Metafunctions, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > /< / span > < span class = "identifier" > function< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dd > < dl >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.function.mp_and_t" > < code class = "computeroutput" > < span class = "identifier" > mp_and< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.function.mp_all_t" > < code class = "computeroutput" > < span class = "identifier" > mp_all< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.function.mp_or_t" > < code class = "computeroutput" > < span class = "identifier" > mp_or< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.function.mp_any_t" > < code class = "computeroutput" > < span class = "identifier" > mp_any< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< / dl > < / dd >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.integer_sequence" > Integer Sequences,
< code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > integer_sequence< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dd > < dl >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.integer_sequence.integer_sequence_t_i" > < code class = "computeroutput" > < span class = "identifier" > integer_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > I< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.integer_sequence.make_integer_sequence_t_n" > < code class = "computeroutput" > < span class = "identifier" > make_integer_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.integer_sequence.index_sequence_i" > < code class = "computeroutput" > < span class = "identifier" > index_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > I< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.integer_sequence.make_index_sequence_n" > < code class = "computeroutput" > < span class = "identifier" > make_index_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.integer_sequence.index_sequence_for_t" > < code class = "computeroutput" > < span class = "identifier" > index_sequence_for< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< / dl > < / dd >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.tuple_for_each" > A "for each"
algorithm for tuple-like types, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > tuple_for_each< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dd > < dl > < dt > < span class = "section" > < a href = "mp11.html#mp11.reference.tuple_for_each.tuple_for_each" > < code class = "computeroutput" > < span class = "identifier" > tuple_for_each< / span > < / code > < / a > < / span > < / dt > < / dl > < / dd >
2017-03-14 22:57:07 +02:00
< / dl > < / dd >
< / dl >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h2 class = "title" style = "clear: both" >
< a name = "mp11.overview" > < / a > < a class = "link" href = "mp11.html#mp11.overview" title = "Overview" > Overview< / a >
< / h2 > < / div > < / div > < / div >
< p >
2017-03-16 19:45:47 +02:00
Mp11 is a C++11 metaprogramming library based on template aliases and variadic
templates. It implements the approach outlined in the article < a href = "http://pdimov.com/cpp2/simple_cxx11_metaprogramming.html" target = "_top" > Simple
C++11 metaprogramming< / a > (< a href = "http://pdimov.com/cpp2/simple_cxx11_metaprogramming_2.html" target = "_top" > part
2< / a > ).
< / p >
< p >
The general principles upon which Mp11 is built are that algorithms and metafunctions
are template aliases of the form < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code >
and data structures are lists of the form < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > ,
with the library placing no requirements on < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > .
< code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code >
is the built-in list type, but < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > ,
< code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > pair< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > > < / span > < / code > and < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > variant< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code >
2017-03-17 05:55:27 +02:00
are also perfectly legitimate list types, although of course < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > pair< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span >
2017-03-16 19:45:47 +02:00
< span class = "identifier" > T2< / span > < span class = "special" > > < / span > < / code > ,
due to having exactly two elements, is not resizeable and will consequently
not work with algorithms that need to add or remove elements.
< / p >
< p >
Another distinguishing feature of this approach is that lists (< code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > ) have the same form as metafunctions
(< code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > )
and can therefore be used as such. For example, applying < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > add_pointer_t< / span > < / code >
2017-03-17 05:55:27 +02:00
to the list < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "keyword" > float< / span > < span class = "special" > > < / span > < / code > by way of < code class = "computeroutput" > < span class = "identifier" > mp_transform< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > add_pointer_t< / span > < span class = "special" > ,< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "keyword" > float< / span > < span class = "special" > > > < / span > < / code > gives us < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > *,< / span > < span class = "keyword" > float< / span > < span class = "special" > *> < / span > < / code > , but we can also apply < code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < / code >
2017-03-16 19:45:47 +02:00
to the same tuple:
< / p >
2017-03-17 05:55:27 +02:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > R< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_transform< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_list< / span > < span class = "special" > ,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "keyword" > float< / span > < span class = "special" > > > ;< / span >
2017-03-16 19:45:47 +02:00
< / pre >
< p >
and get < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > > ,< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "keyword" > float< / span > < span class = "special" > > > < / span > < / code > .
2017-03-14 22:57:07 +02:00
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h2 class = "title" style = "clear: both" >
2017-03-17 05:55:27 +02:00
< a name = "mp11.definitions" > < / a > < a class = "link" href = "mp11.html#mp11.definitions" title = "Definitions" > Definitions< / a >
2017-03-14 22:57:07 +02:00
< / h2 > < / div > < / div > < / div >
2017-03-16 19:45:47 +02:00
< p >
2017-03-17 05:55:27 +02:00
A < span class = "emphasis" > < em > list< / em > < / span > is a — possibly but not necessarily variadic — template
class whose parameters are all types, for example < code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "keyword" > char< / span > < span class = "special" > [],< / span >
< span class = "keyword" > void< / span > < span class = "special" > > < / span > < / code > ,
< code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < span class = "special" > < > < / span > < / code > ,
< code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "keyword" > float< / span > < span class = "special" > ,< / span > < span class = "keyword" > char< / span > < span class = "special" > > < / span > < / code > ,
< code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > pair< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "keyword" > float< / span > < span class = "special" > > < / span > < / code > , < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > shared_ptr< / span > < span class = "special" > < < / span > < span class = "identifier" > X< / span > < span class = "special" > > < / span > < / code > .
< / p >
< p >
A < span class = "emphasis" > < em > metafunction< / em > < / span > is a class template or a template alias
whose parameters are all types, for example < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > add_pointer_t< / span > < / code > ,
< code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > is_const< / span > < / code > , < code class = "computeroutput" > < span class = "identifier" > mp_second< / span > < / code > ,
< code class = "computeroutput" > < span class = "identifier" > mp_push_front< / span > < / code > , < code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < / code > , < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < / code > ,
< code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > pair< / span > < / code > , < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > shared_ptr< / span > < / code > ,
or
< / p >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > using< / span > < span class = "identifier" > F1< / span > < span class = "special" > =< / span > < span class = "keyword" > void< / span > < span class = "special" > ;< / span >
< span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > F2< / span > < span class = "special" > =< / span > < span class = "identifier" > T< / span > < span class = "special" > *;< / span >
< span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > F3< / span > < span class = "special" > =< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > integral_constant< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "special" > ,< / span > < span class = "keyword" > sizeof< / span > < span class = "special" > ...(< / span > < span class = "identifier" > T< / span > < span class = "special" > )> ;< / span >
< / pre >
< p >
A < span class = "emphasis" > < em > quoted metafunction< / em > < / span > is a class with a public metafunction
2017-03-20 16:23:52 +02:00
called < code class = "computeroutput" > < span class = "identifier" > fn< / span > < / code > , for example
2017-03-16 19:45:47 +02:00
< / p >
2017-03-20 16:23:52 +02:00
< pre class = "programlisting" > < span class = "keyword" > struct< / span > < span class = "identifier" > Q1< / span > < span class = "special" > {< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > using< / span > < span class = "identifier" > fn< / span > < span class = "special" > =< / span > < span class = "keyword" > void< / span > < span class = "special" > ;< / span > < span class = "special" > };< / span >
< span class = "keyword" > struct< / span > < span class = "identifier" > Q2< / span > < span class = "special" > {< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > fn< / span > < span class = "special" > =< / span > < span class = "identifier" > T< / span > < span class = "special" > *;< / span > < span class = "special" > };< / span >
< span class = "keyword" > struct< / span > < span class = "identifier" > Q3< / span > < span class = "special" > {< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > fn< / span > < span class = "special" > =< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > integral_constant< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "special" > ,< / span > < span class = "keyword" > sizeof< / span > < span class = "special" > ...(< / span > < span class = "identifier" > T< / span > < span class = "special" > )> ;< / span > < span class = "special" > };< / span >
2017-03-17 05:55:27 +02:00
< / pre >
< p >
An < span class = "emphasis" > < em > integral constant type< / em > < / span > is a class with a public member
< code class = "computeroutput" > < span class = "identifier" > value< / span > < / code > that is an integral constant
in the C++ sense. For example, < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > integral_constant< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span >
< span class = "number" > 7< / span > < span class = "special" > > < / span > < / code > ,
or
< / p >
< pre class = "programlisting" > < span class = "keyword" > struct< / span > < span class = "identifier" > N< / span > < span class = "special" > {< / span > < span class = "keyword" > static< / span > < span class = "keyword" > int< / span > < span class = "keyword" > constexpr< / span > < span class = "identifier" > value< / span > < span class = "special" > =< / span > < span class = "number" > 2< / span > < span class = "special" > ;< / span > < span class = "special" > };< / span >
< / pre >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h2 class = "title" style = "clear: both" >
< a name = "mp11.examples" > < / a > < a class = "link" href = "mp11.html#mp11.examples" title = "Examples" > Examples< / a >
< / h2 > < / div > < / div > < / div >
2017-03-14 22:57:07 +02:00
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
2017-03-17 05:55:27 +02:00
< a name = "mp11.examples.generating_test_cases" > < / a > < a class = "link" href = "mp11.html#mp11.examples.generating_test_cases" title = "Generating Test Cases" > Generating Test
Cases< / a >
2017-03-17 02:28:03 +02:00
< / h3 > < / div > < / div > < / div >
< p >
2017-03-17 05:55:27 +02:00
Let's suppose that we have written a metafunction < code class = "computeroutput" > < span class = "identifier" > result< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span >
< span class = "identifier" > U< / span > < span class = "special" > > < / span > < / code > :
2017-03-17 02:28:03 +02:00
< / p >
2017-03-17 05:55:27 +02:00
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > promote< / span > < span class = "special" > =< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > common_type_t< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "keyword" > int< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > U< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > result< / span > < span class = "special" > =< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > common_type_t< / span > < span class = "special" > < < / span > < span class = "identifier" > promote< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > ,< / span > < span class = "identifier" > promote< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > > > ;< / span >
< / pre >
2017-03-17 02:28:03 +02:00
< p >
2017-03-17 05:55:27 +02:00
that ought to represent the result of an arithmetic operation on the integer
types < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > and < code class = "computeroutput" > < span class = "identifier" > U< / span > < / code > , for example < code class = "computeroutput" > < span class = "identifier" > t< / span >
< span class = "special" > +< / span > < span class = "identifier" > u< / span > < / code > .
We want to test whether < code class = "computeroutput" > < span class = "identifier" > result< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span >
< span class = "identifier" > U< / span > < span class = "special" > > < / span > < / code >
gives correct results for various combinations of < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code >
and < code class = "computeroutput" > < span class = "identifier" > U< / span > < / code > , so we write the function
2017-03-17 02:28:03 +02:00
< / p >
2017-03-17 05:55:27 +02:00
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T2< / span > < span class = "special" > > < / span > < span class = "keyword" > void< / span > < span class = "identifier" > test_result< / span > < span class = "special" > ()< / span >
< span class = "special" > {< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > T3< / span > < span class = "special" > =< / span > < span class = "keyword" > decltype< / span > < span class = "special" > (< / span > < span class = "identifier" > T1< / span > < span class = "special" > ()< / span > < span class = "special" > +< / span > < span class = "identifier" > T2< / span > < span class = "special" > ()< / span > < span class = "special" > );< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > T4< / span > < span class = "special" > =< / span > < span class = "identifier" > result< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > > ;< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > cout< / span > < span class = "special" > < < < / span > < span class = "special" > (< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > is_same< / span > < span class = "special" > < < / span > < span class = "identifier" > T3< / span > < span class = "special" > ,< / span > < span class = "identifier" > T4< / span > < span class = "special" > > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > ?< / span > < span class = "string" > "[PASS]"< / span > < span class = "special" > :< / span > < span class = "string" > "[FAIL]"< / span > < span class = "special" > )< / span > < span class = "special" > < < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > endl< / span > < span class = "special" > ;< / span >
< span class = "special" > }< / span >
2017-03-17 02:28:03 +02:00
< / pre >
< p >
2017-03-17 05:55:27 +02:00
and then need to call it a substantial number of times:
2017-03-17 02:28:03 +02:00
< / p >
2017-03-17 05:55:27 +02:00
< pre class = "programlisting" > < span class = "keyword" > int< / span > < span class = "identifier" > main< / span > < span class = "special" > ()< / span >
< span class = "special" > {< / span >
< span class = "identifier" > test_result< / span > < span class = "special" > < < / span > < span class = "keyword" > char< / span > < span class = "special" > ,< / span > < span class = "keyword" > char< / span > < span class = "special" > > ();< / span >
< span class = "identifier" > test_result< / span > < span class = "special" > < < / span > < span class = "keyword" > char< / span > < span class = "special" > ,< / span > < span class = "keyword" > short< / span > < span class = "special" > > ();< / span >
< span class = "identifier" > test_result< / span > < span class = "special" > < < / span > < span class = "keyword" > char< / span > < span class = "special" > ,< / span > < span class = "keyword" > int< / span > < span class = "special" > > ();< / span >
< span class = "identifier" > test_result< / span > < span class = "special" > < < / span > < span class = "keyword" > char< / span > < span class = "special" > ,< / span > < span class = "keyword" > unsigned< / span > < span class = "special" > > ();< / span >
< span class = "comment" > // ...< / span >
< span class = "special" > }< / span >
2017-03-17 02:28:03 +02:00
< / pre >
< p >
2017-03-17 05:55:27 +02:00
Writing all those type combinations by hand is unwieldy, error prone, and
worst of all, boring. This is how we can leverage Mp11 to automate the task:
2017-03-17 02:28:03 +02:00
< / p >
2017-03-17 05:55:27 +02:00
< pre class = "programlisting" > < span class = "preprocessor" > #include< / span > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span >
< span class = "preprocessor" > #include< / span > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > tuple_for_each< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span >
< span class = "preprocessor" > #include< / span > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > core< / span > < span class = "special" > /< / span > < span class = "identifier" > demangle< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span >
< span class = "preprocessor" > #include< / span > < span class = "special" > < < / span > < span class = "identifier" > type_traits< / span > < span class = "special" > > < / span >
< span class = "preprocessor" > #include< / span > < span class = "special" > < < / span > < span class = "identifier" > iostream< / span > < span class = "special" > > < / span >
< span class = "preprocessor" > #include< / span > < span class = "special" > < < / span > < span class = "identifier" > typeinfo< / span > < span class = "special" > > < / span >
< span class = "keyword" > using< / span > < span class = "keyword" > namespace< / span > < span class = "identifier" > boost< / span > < span class = "special" > ::< / span > < span class = "identifier" > mp11< / span > < span class = "special" > ;< / span >
< span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > string< / span > < span class = "identifier" > name< / span > < span class = "special" > ()< / span >
< span class = "special" > {< / span >
< span class = "keyword" > return< / span > < span class = "identifier" > boost< / span > < span class = "special" > ::< / span > < span class = "identifier" > core< / span > < span class = "special" > ::< / span > < span class = "identifier" > demangle< / span > < span class = "special" > (< / span > < span class = "keyword" > typeid< / span > < span class = "special" > (< / span > < span class = "identifier" > T< / span > < span class = "special" > ).< / span > < span class = "identifier" > name< / span > < span class = "special" > ()< / span > < span class = "special" > );< / span >
< span class = "special" > }< / span >
< span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > promote< / span > < span class = "special" > =< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > common_type_t< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "keyword" > int< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > U< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > result< / span > < span class = "special" > =< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > common_type_t< / span > < span class = "special" > < < / span > < span class = "identifier" > promote< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > ,< / span > < span class = "identifier" > promote< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > > > ;< / span >
< span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T2< / span > < span class = "special" > > < / span > < span class = "keyword" > void< / span > < span class = "identifier" > test_result< / span > < span class = "special" > (< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > > < / span > < span class = "keyword" > const< / span > < span class = "special" > & < / span > < span class = "special" > )< / span >
< span class = "special" > {< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > T3< / span > < span class = "special" > =< / span > < span class = "keyword" > decltype< / span > < span class = "special" > (< / span > < span class = "identifier" > T1< / span > < span class = "special" > ()< / span > < span class = "special" > +< / span > < span class = "identifier" > T2< / span > < span class = "special" > ()< / span > < span class = "special" > );< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > T4< / span > < span class = "special" > =< / span > < span class = "identifier" > result< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > > ;< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > cout< / span > < span class = "special" > < < < / span > < span class = "special" > (< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > is_same< / span > < span class = "special" > < < / span > < span class = "identifier" > T3< / span > < span class = "special" > ,< / span > < span class = "identifier" > T4< / span > < span class = "special" > > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > ?< / span > < span class = "string" > "[PASS] "< / span > < span class = "special" > :< / span > < span class = "string" > "[FAIL] "< / span > < span class = "special" > )< / span > < span class = "special" > < < < / span > < span class = "identifier" > name< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > > ()< / span > < span class = "special" > < < < / span > < span class = "string" > " + "< / span > < span class = "special" > < < < / span > < span class = "identifier" > name< / span > < span class = "special" > < < / span > < span class = "identifier" > T2< / span > < span class = "special" > > ()< / span > < span class = "special" > < < < / span > < span class = "string" > " -> "< / span > < span class = "special" > < < < / span > < span class = "identifier" > name< / span > < span class = "special" > < < / span > < span class = "identifier" > T3< / span > < span class = "special" > > ()< / span > < span class = "special" > < < < / span > < span class = "string" > ", result: "< / span > < span class = "special" > < < < / span > < span class = "identifier" > name< / span > < span class = "special" > < < / span > < span class = "identifier" > T4< / span > < span class = "special" > > ()< / span > < span class = "special" > < < < / span > < span class = "string" > " "< / span > < span class = "special" > < < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > endl< / span > < span class = "special" > ;< / span >
< span class = "special" > }< / span >
< span class = "keyword" > int< / span > < span class = "identifier" > main< / span > < span class = "special" > ()< / span >
< span class = "special" > {< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L< / span > < span class = "special" > =< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < span class = "special" > < < / span > < span class = "keyword" > char< / span > < span class = "special" > ,< / span > < span class = "keyword" > short< / span > < span class = "special" > ,< / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "keyword" > unsigned< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "special" > ,< / span > < span class = "keyword" > unsigned< / span > < span class = "keyword" > long< / span > < span class = "special" > > ;< / span >
< span class = "identifier" > boost< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple_for_each< / span > < span class = "special" > (< / span > < span class = "identifier" > mp_product< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_list< / span > < span class = "special" > ,< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > L< / span > < span class = "special" > > (),< / span > < span class = "special" > [](< / span > < span class = "keyword" > auto< / span > < span class = "special" > & & < / span > < span class = "identifier" > x< / span > < span class = "special" > ){< / span > < span class = "identifier" > test_result< / span > < span class = "special" > (< / span > < span class = "identifier" > x< / span > < span class = "special" > );< / span > < span class = "special" > }< / span > < span class = "special" > );< / span >
< span class = "special" > }< / span >
2017-03-17 02:28:03 +02:00
< / pre >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
2017-03-17 05:55:27 +02:00
< a name = "mp11.examples.computing_return_types" > < / a > < a class = "link" href = "mp11.html#mp11.examples.computing_return_types" title = "Computing Return Types" > Computing Return
Types< / a >
< / h3 > < / div > < / div > < / div >
< p >
C++17 has a standard variant type, called < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > variant< / span > < / code > .
It also defines a function template < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > visit< / span > < / code >
that can be used to apply a function to the contained value of one or more
< code class = "computeroutput" > < span class = "identifier" > variant< / span > < / code > s. So for instance,
if the < code class = "computeroutput" > < span class = "identifier" > variant< / span > < / code > < code class = "computeroutput" > < span class = "identifier" > v1< / span > < / code > contains < code class = "computeroutput" > < span class = "number" > 1< / span > < / code > ,
and the < code class = "computeroutput" > < span class = "identifier" > variant< / span > < / code > < code class = "computeroutput" > < span class = "identifier" > v2< / span > < / code > contains < code class = "computeroutput" > < span class = "number" > 2.0f< / span > < / code > ,
< code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > visit< / span > < span class = "special" > (< / span > < span class = "identifier" > f< / span > < span class = "special" > ,< / span > < span class = "identifier" > v1< / span > < span class = "special" > ,< / span > < span class = "identifier" > v2< / span > < span class = "special" > )< / span > < / code >
will call < code class = "computeroutput" > < span class = "identifier" > f< / span > < span class = "special" > (< / span > < span class = "number" > 1< / span > < span class = "special" > ,< / span > < span class = "number" > 2.0f< / span > < span class = "special" > )< / span > < / code > .
< / p >
< p >
However, < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > visit< / span > < / code > has one limitation: it cannot return
a result unless all possible applications of the function have the same return
type. If, for instance, < code class = "computeroutput" > < span class = "identifier" > v1< / span > < / code >
and < code class = "computeroutput" > < span class = "identifier" > v2< / span > < / code > are both of type
< code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > variant< / span > < span class = "special" > < < / span > < span class = "keyword" > short< / span > < span class = "special" > ,< / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "keyword" > float< / span > < span class = "special" > > < / span > < / code > ,
< / p >
< pre class = "programlisting" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > visit< / span > < span class = "special" > (< / span > < span class = "special" > [](< / span > < span class = "keyword" > auto< / span > < span class = "keyword" > const< / span > < span class = "special" > & < / span > < span class = "identifier" > x< / span > < span class = "special" > ,< / span > < span class = "keyword" > auto< / span > < span class = "keyword" > const< / span > < span class = "special" > & < / span > < span class = "identifier" > y< / span > < span class = "special" > ){< / span > < span class = "keyword" > return< / span > < span class = "identifier" > x< / span > < span class = "special" > +< / span > < span class = "identifier" > y< / span > < span class = "special" > ;< / span > < span class = "special" > },< / span > < span class = "identifier" > v1< / span > < span class = "special" > ,< / span > < span class = "identifier" > v2< / span > < span class = "special" > );< / span >
< / pre >
< p >
will fail to compile because the result of < code class = "computeroutput" > < span class = "identifier" > x< / span >
< span class = "special" > +< / span > < span class = "identifier" > y< / span > < / code >
can be either < code class = "computeroutput" > < span class = "keyword" > int< / span > < / code > or < code class = "computeroutput" > < span class = "keyword" > float< / span > < / code > depending on what < code class = "computeroutput" > < span class = "identifier" > v1< / span > < / code >
and < code class = "computeroutput" > < span class = "identifier" > v2< / span > < / code > hold.
< / p >
< p >
A type that can hold either < code class = "computeroutput" > < span class = "keyword" > int< / span > < / code >
or < code class = "computeroutput" > < span class = "keyword" > float< / span > < / code > already exists, called,
surprisingly enough, < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > variant< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span >
< span class = "keyword" > float< / span > < span class = "special" > > < / span > < / code > .
Let's write our own function template < code class = "computeroutput" > < span class = "identifier" > rvisit< / span > < / code >
that is the same as < code class = "computeroutput" > < span class = "identifier" > visit< / span > < / code >
but returns a < code class = "computeroutput" > < span class = "identifier" > variant< / span > < / code > :
< / p >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < span class = "keyword" > auto< / span > < span class = "identifier" > rvisit< / span > < span class = "special" > (< / span > < span class = "identifier" > F< / span > < span class = "special" > & & < / span > < span class = "identifier" > f< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > & & ...< / span > < span class = "identifier" > v< / span > < span class = "special" > )< / span >
< span class = "special" > {< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< span class = "keyword" > return< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > visit< / span > < span class = "special" > (< / span > < span class = "special" > [& ](< / span > < span class = "keyword" > auto< / span > < span class = "special" > & & ...< / span > < span class = "identifier" > x< / span > < span class = "special" > ){< / span > < span class = "keyword" > return< / span > < span class = "identifier" > R< / span > < span class = "special" > (< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > forward< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > > (< / span > < span class = "identifier" > f< / span > < span class = "special" > )(< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > forward< / span > < span class = "special" > < < / span > < span class = "keyword" > decltype< / span > < span class = "special" > (< / span > < span class = "identifier" > x< / span > < span class = "special" > )> (< / span > < span class = "identifier" > x< / span > < span class = "special" > )...< / span > < span class = "special" > )< / span > < span class = "special" > );< / span > < span class = "special" > },< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > forward< / span > < span class = "special" > < < / span > < span class = "identifier" > V< / span > < span class = "special" > > (< / span > < span class = "identifier" > v< / span > < span class = "special" > )...< / span > < span class = "special" > );< / span >
< span class = "special" > }< / span >
< / pre >
< p >
What this does is basically calls < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > visit< / span > < / code >
to do the work, but instead of passing it < code class = "computeroutput" > < span class = "identifier" > f< / span > < / code > ,
we pass a lambda that does the same as < code class = "computeroutput" > < span class = "identifier" > f< / span > < / code >
except it converts the result to a common type < code class = "computeroutput" > < span class = "identifier" > R< / span > < / code > .
< code class = "computeroutput" > < span class = "identifier" > R< / span > < / code > is supposed to be < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > variant< / span > < span class = "special" > < ...> < / span > < / code > where the ellipsis denotes the
return types of calling < code class = "computeroutput" > < span class = "identifier" > f< / span > < / code >
with all possible combinations of variant values.
< / p >
< p >
We'll first define a helper quoted metafunction < code class = "computeroutput" > < span class = "identifier" > Qret< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < / code >
that returns the result of the application of < code class = "computeroutput" > < span class = "identifier" > F< / span > < / code >
to arguments of type < code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < / code > :
< / p >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < span class = "keyword" > struct< / span > < span class = "identifier" > Qret< / span >
< span class = "special" > {< / span >
2017-03-20 16:23:52 +02:00
< span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > fn< / span > < span class = "special" > =< / span > < span class = "keyword" > decltype< / span > < span class = "special" > (< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > declval< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > > ()(< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > declval< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > ()...< / span > < span class = "special" > )< / span > < span class = "special" > );< / span >
2017-03-17 05:55:27 +02:00
< span class = "special" > };< / span >
< / pre >
< p >
(Unfortunately, we can't just define this metafunction inside < code class = "computeroutput" > < span class = "identifier" > rvisit< / span > < / code > ; the language prohibits defining
template aliases inside functions.)
< / p >
< p >
With < code class = "computeroutput" > < span class = "identifier" > Qret< / span > < / code > in hand, a < code class = "computeroutput" > < span class = "identifier" > variant< / span > < / code > of the possible return types is
just a matter of applying it over the possible combinations of the variant
values:
< / p >
2017-03-20 16:23:52 +02:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > R< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_product< / span > < span class = "special" > < < / span > < span class = "identifier" > Qret< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > > ::< / span > < span class = "keyword" > template< / span > < span class = "identifier" > fn< / span > < span class = "special" > ,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > remove_reference_t< / span > < span class = "special" > < < / span > < span class = "identifier" > V< / span > < span class = "special" > > ...> ;< / span >
2017-03-17 05:55:27 +02:00
< / pre >
< p >
Why does this work? < code class = "computeroutput" > < span class = "identifier" > mp_product< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span >
< span class = "identifier" > L1< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > L2< / span > < span class = "special" > < < / span > < span class = "identifier" > T2< / span > < span class = "special" > ...> ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > Ln< / span > < span class = "special" > < < / span > < span class = "identifier" > Tn< / span > < span class = "special" > ...> > < / span > < / code > returns < code class = "computeroutput" > < span class = "identifier" > L1< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > U1< / span > < span class = "special" > ,< / span > < span class = "identifier" > U2< / span > < span class = "special" > ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > Un< / span > < span class = "special" > > ,< / span > < span class = "special" > ...> < / span > < / code > ,
where < code class = "computeroutput" > < span class = "identifier" > Ui< / span > < / code > traverse all possible
combinations of list values. Since in our case all < code class = "computeroutput" > < span class = "identifier" > Li< / span > < / code >
are < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > variant< / span > < / code > , the result will also be < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > variant< / span > < / code > .
< / p >
< p >
One more step remains. Suppose that, as above, we're passing two variants
of type < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > variant< / span > < span class = "special" > < < / span > < span class = "keyword" > short< / span > < span class = "special" > ,< / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "keyword" > float< / span > < span class = "special" > > < / span > < / code >
and < code class = "computeroutput" > < span class = "identifier" > F< / span > < / code > is < code class = "computeroutput" > < span class = "special" > [](< / span >
< span class = "keyword" > auto< / span > < span class = "keyword" > const< / span > < span class = "special" > & < / span > < span class = "identifier" > x< / span > < span class = "special" > ,< / span > < span class = "keyword" > auto< / span > < span class = "keyword" > const< / span > < span class = "special" > & < / span > < span class = "identifier" > y< / span > < span class = "special" > ){< / span > < span class = "keyword" > return< / span > < span class = "identifier" > x< / span > < span class = "special" > +< / span > < span class = "identifier" > y< / span > < span class = "special" > ;< / span > < span class = "special" > }< / span > < / code > . This
will generate < code class = "computeroutput" > < span class = "identifier" > R< / span > < / code > of length
9, one per each combination, but many of those elements will be the same,
either < code class = "computeroutput" > < span class = "keyword" > int< / span > < / code > or < code class = "computeroutput" > < span class = "keyword" > float< / span > < / code > , and we need to filter out the duplicates.
So,
< / p >
2017-03-20 16:23:52 +02:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > R< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_unique< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_product< / span > < span class = "special" > < < / span > < span class = "identifier" > Qret< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > > ::< / span > < span class = "keyword" > template< / span > < span class = "identifier" > fn< / span > < span class = "special" > ,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > remove_reference_t< / span > < span class = "special" > < < / span > < span class = "identifier" > V< / span > < span class = "special" > > ...> > ;< / span >
2017-03-17 05:55:27 +02:00
< / pre >
< p >
and we're done:
< / p >
< pre class = "programlisting" > < span class = "preprocessor" > #include< / span > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span >
< span class = "preprocessor" > #include< / span > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > core< / span > < span class = "special" > /< / span > < span class = "identifier" > demangle< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span >
< span class = "preprocessor" > #include< / span > < span class = "special" > < < / span > < span class = "identifier" > variant< / span > < span class = "special" > > < / span >
< span class = "preprocessor" > #include< / span > < span class = "special" > < < / span > < span class = "identifier" > type_traits< / span > < span class = "special" > > < / span >
< span class = "preprocessor" > #include< / span > < span class = "special" > < < / span > < span class = "identifier" > typeinfo< / span > < span class = "special" > > < / span >
< span class = "preprocessor" > #include< / span > < span class = "special" > < < / span > < span class = "identifier" > iostream< / span > < span class = "special" > > < / span >
< span class = "keyword" > using< / span > < span class = "keyword" > namespace< / span > < span class = "identifier" > boost< / span > < span class = "special" > ::< / span > < span class = "identifier" > mp11< / span > < span class = "special" > ;< / span >
< span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < span class = "keyword" > struct< / span > < span class = "identifier" > Qret< / span >
< span class = "special" > {< / span >
2017-03-20 16:23:52 +02:00
< span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > fn< / span > < span class = "special" > =< / span > < span class = "keyword" > decltype< / span > < span class = "special" > (< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > declval< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > > ()(< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > declval< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > ()...< / span > < span class = "special" > )< / span > < span class = "special" > );< / span >
2017-03-17 05:55:27 +02:00
< span class = "special" > };< / span >
< span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < span class = "keyword" > auto< / span > < span class = "identifier" > rvisit< / span > < span class = "special" > (< / span > < span class = "identifier" > F< / span > < span class = "special" > & & < / span > < span class = "identifier" > f< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > & & ...< / span > < span class = "identifier" > v< / span > < span class = "special" > )< / span >
< span class = "special" > {< / span >
2017-03-20 16:23:52 +02:00
< span class = "keyword" > using< / span > < span class = "identifier" > R< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_unique< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_product< / span > < span class = "special" > < < / span > < span class = "identifier" > Qret< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > > ::< / span > < span class = "keyword" > template< / span > < span class = "identifier" > fn< / span > < span class = "special" > ,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > remove_reference_t< / span > < span class = "special" > < < / span > < span class = "identifier" > V< / span > < span class = "special" > > ...> > ;< / span >
2017-03-17 05:55:27 +02:00
< span class = "keyword" > return< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > visit< / span > < span class = "special" > (< / span > < span class = "special" > [& ](< / span > < span class = "keyword" > auto< / span > < span class = "special" > & & ...< / span > < span class = "identifier" > x< / span > < span class = "special" > ){< / span > < span class = "keyword" > return< / span > < span class = "identifier" > R< / span > < span class = "special" > (< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > forward< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > > (< / span > < span class = "identifier" > f< / span > < span class = "special" > )(< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > forward< / span > < span class = "special" > < < / span > < span class = "keyword" > decltype< / span > < span class = "special" > (< / span > < span class = "identifier" > x< / span > < span class = "special" > )> (< / span > < span class = "identifier" > x< / span > < span class = "special" > )...< / span > < span class = "special" > )< / span > < span class = "special" > );< / span > < span class = "special" > },< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > forward< / span > < span class = "special" > < < / span > < span class = "identifier" > V< / span > < span class = "special" > > (< / span > < span class = "identifier" > v< / span > < span class = "special" > )...< / span > < span class = "special" > );< / span >
< span class = "special" > }< / span >
< span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > string< / span > < span class = "identifier" > name< / span > < span class = "special" > ()< / span >
< span class = "special" > {< / span >
< span class = "keyword" > return< / span > < span class = "identifier" > boost< / span > < span class = "special" > ::< / span > < span class = "identifier" > core< / span > < span class = "special" > ::< / span > < span class = "identifier" > demangle< / span > < span class = "special" > (< / span > < span class = "keyword" > typeid< / span > < span class = "special" > (< / span > < span class = "identifier" > T< / span > < span class = "special" > ).< / span > < span class = "identifier" > name< / span > < span class = "special" > ()< / span > < span class = "special" > );< / span >
< span class = "special" > }< / span >
< span class = "keyword" > int< / span > < span class = "identifier" > main< / span > < span class = "special" > ()< / span >
< span class = "special" > {< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > variant< / span > < span class = "special" > < < / span > < span class = "keyword" > signed< / span > < span class = "keyword" > char< / span > < span class = "special" > ,< / span > < span class = "keyword" > unsigned< / span > < span class = "keyword" > char< / span > < span class = "special" > ,< / span > < span class = "keyword" > signed< / span > < span class = "keyword" > short< / span > < span class = "special" > ,< / span > < span class = "keyword" > unsigned< / span > < span class = "keyword" > short< / span > < span class = "special" > ,< / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "keyword" > unsigned< / span > < span class = "special" > > < / span > < span class = "identifier" > v1< / span > < span class = "special" > (< / span > < span class = "number" > 1< / span > < span class = "special" > );< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > cout< / span > < span class = "special" > < < < / span > < span class = "string" > "("< / span > < span class = "special" > < < < / span > < span class = "identifier" > name< / span > < span class = "special" > < < / span > < span class = "keyword" > decltype< / span > < span class = "special" > (< / span > < span class = "identifier" > v1< / span > < span class = "special" > )> ()< / span > < span class = "special" > < < < / span > < span class = "string" > ")v1: "< / span > < span class = "special" > ;< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > visit< / span > < span class = "special" > (< / span > < span class = "special" > [](< / span > < span class = "keyword" > auto< / span > < span class = "keyword" > const< / span > < span class = "special" > & < / span > < span class = "identifier" > x< / span > < span class = "special" > ){< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > cout< / span > < span class = "special" > < < < / span > < span class = "string" > "("< / span > < span class = "special" > < < < / span > < span class = "identifier" > name< / span > < span class = "special" > < < / span > < span class = "keyword" > decltype< / span > < span class = "special" > (< / span > < span class = "identifier" > x< / span > < span class = "special" > )> ()< / span > < span class = "special" > < < < / span > < span class = "string" > ")"< / span > < span class = "special" > < < < / span > < span class = "identifier" > x< / span > < span class = "special" > < < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > endl< / span > < span class = "special" > ;< / span > < span class = "special" > },< / span > < span class = "identifier" > v1< / span > < span class = "special" > );< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > variant< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "keyword" > float< / span > < span class = "special" > ,< / span > < span class = "keyword" > double< / span > < span class = "special" > > < / span > < span class = "identifier" > v2< / span > < span class = "special" > (< / span > < span class = "number" > 2.0f< / span > < span class = "special" > );< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > cout< / span > < span class = "special" > < < < / span > < span class = "string" > "("< / span > < span class = "special" > < < < / span > < span class = "identifier" > name< / span > < span class = "special" > < < / span > < span class = "keyword" > decltype< / span > < span class = "special" > (< / span > < span class = "identifier" > v2< / span > < span class = "special" > )> ()< / span > < span class = "special" > < < < / span > < span class = "string" > ")v2: "< / span > < span class = "special" > ;< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > visit< / span > < span class = "special" > (< / span > < span class = "special" > [](< / span > < span class = "keyword" > auto< / span > < span class = "keyword" > const< / span > < span class = "special" > & < / span > < span class = "identifier" > x< / span > < span class = "special" > ){< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > cout< / span > < span class = "special" > < < < / span > < span class = "string" > "("< / span > < span class = "special" > < < < / span > < span class = "identifier" > name< / span > < span class = "special" > < < / span > < span class = "keyword" > decltype< / span > < span class = "special" > (< / span > < span class = "identifier" > x< / span > < span class = "special" > )> ()< / span > < span class = "special" > < < < / span > < span class = "string" > ")"< / span > < span class = "special" > < < < / span > < span class = "identifier" > x< / span > < span class = "special" > < < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > endl< / span > < span class = "special" > ;< / span > < span class = "special" > },< / span > < span class = "identifier" > v2< / span > < span class = "special" > );< / span >
< span class = "keyword" > auto< / span > < span class = "identifier" > v3< / span > < span class = "special" > =< / span > < span class = "identifier" > rvisit< / span > < span class = "special" > (< / span > < span class = "special" > [](< / span > < span class = "keyword" > auto< / span > < span class = "keyword" > const< / span > < span class = "special" > & < / span > < span class = "identifier" > x< / span > < span class = "special" > ,< / span > < span class = "keyword" > auto< / span > < span class = "keyword" > const< / span > < span class = "special" > & < / span > < span class = "identifier" > y< / span > < span class = "special" > ){< / span > < span class = "keyword" > return< / span > < span class = "identifier" > x< / span > < span class = "special" > +< / span > < span class = "identifier" > y< / span > < span class = "special" > ;< / span > < span class = "special" > },< / span > < span class = "identifier" > v1< / span > < span class = "special" > ,< / span > < span class = "identifier" > v2< / span > < span class = "special" > );< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > cout< / span > < span class = "special" > < < < / span > < span class = "string" > "("< / span > < span class = "special" > < < < / span > < span class = "identifier" > name< / span > < span class = "special" > < < / span > < span class = "keyword" > decltype< / span > < span class = "special" > (< / span > < span class = "identifier" > v3< / span > < span class = "special" > )> ()< / span > < span class = "special" > < < < / span > < span class = "string" > ")v3: "< / span > < span class = "special" > ;< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > visit< / span > < span class = "special" > (< / span > < span class = "special" > [](< / span > < span class = "keyword" > auto< / span > < span class = "keyword" > const< / span > < span class = "special" > & < / span > < span class = "identifier" > x< / span > < span class = "special" > ){< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > cout< / span > < span class = "special" > < < < / span > < span class = "string" > "("< / span > < span class = "special" > < < < / span > < span class = "identifier" > name< / span > < span class = "special" > < < / span > < span class = "keyword" > decltype< / span > < span class = "special" > (< / span > < span class = "identifier" > x< / span > < span class = "special" > )> ()< / span > < span class = "special" > < < < / span > < span class = "string" > ")"< / span > < span class = "special" > < < < / span > < span class = "identifier" > x< / span > < span class = "special" > < < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > endl< / span > < span class = "special" > ;< / span > < span class = "special" > },< / span > < span class = "identifier" > v3< / span > < span class = "special" > );< / span >
< span class = "special" > }< / span >
< / pre >
< / div >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h2 class = "title" style = "clear: both" >
< a name = "mp11.reference" > < / a > < a class = "link" href = "mp11.html#mp11.reference" title = "Reference" > Reference< / a >
< / h2 > < / div > < / div > < / div >
< p >
The contents of the library are in namespace < code class = "computeroutput" > < span class = "identifier" > boost< / span > < span class = "special" > ::< / span > < span class = "identifier" > mp11< / span > < / code > , unless
specified otherwise.
< / p >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
2017-03-14 22:57:07 +02:00
< a name = "mp11.reference.integral" > < / a > < a class = "link" href = "mp11.html#mp11.reference.integral" title = "Integral Constants, <boost/mp11/integral.hpp>" > Integral Constants, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > /< / span > < span class = "identifier" > integral< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a >
< / h3 > < / div > < / div > < / div >
2017-03-16 19:45:47 +02:00
< p >
For an Mp11 integral constant type < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > ,
< code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < / code > is an integral constant in the C++
sense.
< / p >
2017-03-14 22:57:07 +02:00
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.integral.mp_bool_b" > < / a > < a class = "link" href = "mp11.html#mp11.reference.integral.mp_bool_b" title = "mp_bool<B>" > < code class = "computeroutput" > < span class = "identifier" > mp_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > B< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > bool< / span > < span class = "identifier" > B< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_bool< / span > < span class = "special" > =< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > integral_constant< / span > < span class = "special" > < < / span > < span class = "keyword" > bool< / span > < span class = "special" > ,< / span > < span class = "identifier" > B< / span > < span class = "special" > > ;< / span >
< / pre >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.integral.mp_true" > < / a > < a class = "link" href = "mp11.html#mp11.reference.integral.mp_true" title = "mp_true" > < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > mp_true< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_bool< / span > < span class = "special" > < < / span > < span class = "keyword" > true< / span > < span class = "special" > > ;< / span >
< / pre >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.integral.mp_false" > < / a > < a class = "link" href = "mp11.html#mp11.reference.integral.mp_false" title = "mp_false" > < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > mp_false< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_bool< / span > < span class = "special" > < < / span > < span class = "keyword" > false< / span > < span class = "special" > > ;< / span >
< / pre >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.integral.mp_to_bool_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.integral.mp_to_bool_t" title = "mp_to_bool<T>" > < code class = "computeroutput" > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_bool< / span > < span class = "special" > < < / span > < span class = "keyword" > static_cast< / span > < span class = "special" > < < / span > < span class = "keyword" > bool< / span > < span class = "special" > > (< / span > < span class = "identifier" > T< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > )> ;< / span >
< / pre >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.integral.mp_not_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.integral.mp_not_t" title = "mp_not<T>" > < code class = "computeroutput" > < span class = "identifier" > mp_not< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_not< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_bool< / span > < span class = "special" > < < / span > < span class = "special" > !< / span > < span class = "identifier" > T< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > > ;< / span >
< / pre >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.integral.mp_int_i" > < / a > < a class = "link" href = "mp11.html#mp11.reference.integral.mp_int_i" title = "mp_int<I>" > < code class = "computeroutput" > < span class = "identifier" > mp_int< / span > < span class = "special" > < < / span > < span class = "identifier" > I< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "identifier" > I< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_int< / span > < span class = "special" > =< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > integral_constant< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "identifier" > I< / span > < span class = "special" > > ;< / span >
< / pre >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.integral.mp_size_t_n" > < / a > < a class = "link" href = "mp11.html#mp11.reference.integral.mp_size_t_n" title = "mp_size_t<N>" > < code class = "computeroutput" > < span class = "identifier" > mp_size_t< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_size_t< / span > < span class = "special" > =< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > integral_constant< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > ;< / span >
< / pre >
< / div >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
< a name = "mp11.reference.list" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list" title = "List Operations, <boost/mp11/list.hpp>" > List Operations, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > /< / span > < span class = "identifier" > list< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a >
< / h3 > < / div > < / div > < / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_list_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_list_t" title = "mp_list<T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > struct< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > {};< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < / code > is the standard
list type of Mp11, although the library is not restricted to it and can
operate on arbitrary class templates such as < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < / code >
or < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > variant< / span > < / code > . Even < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > pair< / span > < / code >
can be used if the transformation does not alter the number of the elements
in the list.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_size_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_size_l" title = "mp_size<L>" > < code class = "computeroutput" > < span class = "identifier" > mp_size< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_size< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_size< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code >
returns the number of elements in the list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > ,
as a < code class = "computeroutput" > < span class = "identifier" > mp_size_t< / span > < / code > . In other
words, < code class = "computeroutput" > < span class = "identifier" > mp_size< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > mp_size_t< / span > < span class = "special" > < < / span > < span class = "keyword" > sizeof< / span > < span class = "special" > ...(< / span > < span class = "identifier" > T< / span > < span class = "special" > )> < / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_empty_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_empty_l" title = "mp_empty<L>" > < code class = "computeroutput" > < span class = "identifier" > mp_empty< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_empty< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_size< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > ==< / span > < span class = "number" > 0< / span > < span class = "special" > > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_empty< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code >
if the list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > is empty,
for < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code > otherwise.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_front_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_front_l" title = "mp_front<L>" > < code class = "computeroutput" > < span class = "identifier" > mp_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_front< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code >
is the first element of the list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > .
That is, < code class = "computeroutput" > < span class = "identifier" > mp_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > T1< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_pop_front_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_pop_front_l" title = "mp_pop_front<L>" > < code class = "computeroutput" > < span class = "identifier" > mp_pop_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_pop_front< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_pop_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code >
removes the first element of the list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > .
That is, < code class = "computeroutput" > < span class = "identifier" > mp_pop_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_first_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_first_l" title = "mp_first<L>" > < code class = "computeroutput" > < span class = "identifier" > mp_first< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_first< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_first< / span > < / code > is another name
for < code class = "computeroutput" > < span class = "identifier" > mp_front< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_rest_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_rest_l" title = "mp_rest<L>" > < code class = "computeroutput" > < span class = "identifier" > mp_rest< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_rest< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_pop_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_rest< / span > < / code > is another name
for < code class = "computeroutput" > < span class = "identifier" > mp_pop_front< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_second_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_second_l" title = "mp_second<L>" > < code class = "computeroutput" > < span class = "identifier" > mp_second< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_second< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_second< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code >
is the second element of the list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > .
That is, < code class = "computeroutput" > < span class = "identifier" > mp_second< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > T2< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_third_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_third_l" title = "mp_third<L>" > < code class = "computeroutput" > < span class = "identifier" > mp_third< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_third< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_third< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code >
is the third element of the list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > .
That is, < code class = "computeroutput" > < span class = "identifier" > mp_third< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "identifier" > T3< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > T3< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_push_front_l_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_push_front_l_t" title = "mp_push_front<L, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_push_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_push_front< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_push_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > inserts the elements < code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < / code >
at the front of the list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > .
That is, < code class = "computeroutput" > < span class = "identifier" > mp_push_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > is an alias for < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...,< / span > < span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_push_back_l_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_push_back_l_t" title = "mp_push_back<L, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_push_back< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_push_back< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_push_back< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > inserts the elements < code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < / code >
at the back of the list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > .
That is, < code class = "computeroutput" > < span class = "identifier" > mp_push_back< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > ...,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_rename_l_y" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_rename_l_y" title = "mp_rename<L, Y>" > < code class = "computeroutput" > < span class = "identifier" > mp_rename< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span >
< span class = "identifier" > Y< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > Y< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_rename< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_rename< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > Y< / span > < span class = "special" > > < / span > < / code > changes the type of the list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > to < code class = "computeroutput" > < span class = "identifier" > Y< / span > < / code > .
That is, < code class = "computeroutput" > < span class = "identifier" > mp_rename< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > Y< / span > < span class = "special" > > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > Y< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
2017-03-24 14:26:31 +02:00
< a name = "mp11.reference.list.mp_apply_f_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_apply_f_l" title = "mp_apply<F, L>" > < code class = "computeroutput" > < span class = "identifier" > mp_apply< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span >
< span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_apply< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_rename< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_apply< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > applies the function < code class = "computeroutput" > < span class = "identifier" > F< / span > < / code > to the contents of the list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > , that is, < code class = "computeroutput" > < span class = "identifier" > mp_rename< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > .
(< code class = "computeroutput" > < span class = "identifier" > mp_apply< / span > < / code > is the same as
< code class = "computeroutput" > < span class = "identifier" > mp_rename< / span > < / code > with the arguments
reversed.)
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
2017-03-14 22:57:07 +02:00
< a name = "mp11.reference.list.mp_append_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_append_l" title = "mp_append<L...>" > < code class = "computeroutput" > < span class = "identifier" > mp_append< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_append< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_append< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ...> < / span > < / code >
concatenates the lists in < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > ...< / span > < / code > into a single list that has the same
type as the first list. < code class = "computeroutput" > < span class = "identifier" > mp_append< / span > < span class = "special" > < > < / span > < / code > is an alias for < code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < span class = "special" > < > < / span > < / code > . < code class = "computeroutput" > < span class = "identifier" > mp_append< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > L2< / span > < span class = "special" > < < / span > < span class = "identifier" > T2< / span > < span class = "special" > ...> ,< / span > < span class = "special" > ...,< / span >
< span class = "identifier" > Ln< / span > < span class = "special" > < < / span > < span class = "identifier" > Tn< / span > < span class = "special" > ...> > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > L1< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ...,< / span > < span class = "identifier" > T2< / span > < span class = "special" > ...,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > Tn< / span > < span class = "special" > ...> < / span > < / code > .
< / p >
< / div >
2017-03-18 20:36:58 +02:00
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_replace_front_l_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_replace_front_l_t" title = "mp_replace_front<L, T>" > < code class = "computeroutput" > < span class = "identifier" > mp_replace_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_replace_front< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_replace_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > replaces the first element of the list
< code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > with < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > .
That is, < code class = "computeroutput" > < span class = "identifier" > mp_replace_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > U1< / span > < span class = "special" > ,< / span > < span class = "identifier" > U< / span > < span class = "special" > ...> ,< / span >
< span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_replace_first_l_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_replace_first_l_t" title = "mp_replace_first<L, T>" > < code class = "computeroutput" > < span class = "identifier" > mp_replace_first< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_replace_first< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_replace_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_replace_first< / span > < / code > is another
name for < code class = "computeroutput" > < span class = "identifier" > mp_replace_front< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_replace_second_l_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_replace_second_l_t" title = "mp_replace_second<L, T>" > < code class = "computeroutput" > < span class = "identifier" > mp_replace_second< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_replace_second< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_replace_second< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > replaces the second element of the
list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > with < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > . That is, < code class = "computeroutput" > < span class = "identifier" > mp_replace_second< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > U1< / span > < span class = "special" > ,< / span > < span class = "identifier" > U2< / span > < span class = "special" > ,< / span > < span class = "identifier" > U< / span > < span class = "special" > ...> ,< / span >
< span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > U1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.list.mp_replace_third_l_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_replace_third_l_t" title = "mp_replace_third<L, T>" > < code class = "computeroutput" > < span class = "identifier" > mp_replace_third< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_replace_third< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_replace_third< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > replaces the third element of the list
< code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > with < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > .
That is, < code class = "computeroutput" > < span class = "identifier" > mp_replace_third< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > U1< / span > < span class = "special" > ,< / span > < span class = "identifier" > U2< / span > < span class = "special" > ,< / span > < span class = "identifier" > U3< / span > < span class = "special" > ,< / span > < span class = "identifier" > U< / span > < span class = "special" > ...> ,< / span >
< span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > U1< / span > < span class = "special" > ,< / span > < span class = "identifier" > U2< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > .
< / p >
< / div >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
< a name = "mp11.reference.utility" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility" title = "Utility Components, <boost/mp11/utility.hpp>" > Utility Components, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > /< / span > < span class = "identifier" > utility< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a >
< / h3 > < / div > < / div > < / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.utility.mp_identity_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_identity_t" title = "mp_identity<T>" > < code class = "computeroutput" > < span class = "identifier" > mp_identity< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > struct< / span > < span class = "identifier" > mp_identity< / span >
< span class = "special" > {< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > type< / span > < span class = "special" > =< / span > < span class = "identifier" > T< / span > < span class = "special" > ;< / span >
< span class = "special" > };< / span >
< / pre >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.utility.mp_identity_t_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_identity_t_t" title = "mp_identity_t<T>" > < code class = "computeroutput" > < span class = "identifier" > mp_identity_t< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_identity_t< / span > < span class = "special" > =< / span > < span class = "identifier" > T< / span > < span class = "special" > ;< / span >
< / pre >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.utility.mp_inherit_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_inherit_t" title = "mp_inherit<T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_inherit< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > struct< / span > < span class = "identifier" > mp_inherit< / span > < span class = "special" > :< / span > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < span class = "special" > {};< / span >
< / pre >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.utility.mp_if_c_b_t_e" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_if_c_b_t_e" title = "mp_if_c<B, T, E>" > < code class = "computeroutput" > < span class = "identifier" > mp_if_c< / span > < span class = "special" > < < / span > < span class = "identifier" > B< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > E< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > bool< / span > < span class = "identifier" > C< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > E< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_if_c< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_if_c< / span > < span class = "special" > < < / span > < span class = "identifier" > B< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > E< / span > < span class = "special" > > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > when
< code class = "computeroutput" > < span class = "identifier" > B< / span > < / code > is < code class = "computeroutput" > < span class = "keyword" > true< / span > < / code > ,
for < code class = "computeroutput" > < span class = "identifier" > E< / span > < / code > otherwise.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.utility.mp_if_c_t_e" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_if_c_t_e" title = "mp_if<C, T, E>" > < code class = "computeroutput" > < span class = "identifier" > mp_if< / span > < span class = "special" > < < / span > < span class = "identifier" > C< / span > < span class = "special" > ,< / span >
< span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > E< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > C< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > E< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_if< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_if_c< / span > < span class = "special" > < < / span > < span class = "keyword" > static_cast< / span > < span class = "special" > < < / span > < span class = "keyword" > bool< / span > < span class = "special" > > (< / span > < span class = "identifier" > C< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > ),< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > E< / span > < span class = "special" > > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_if< / span > < span class = "special" > < < / span > < span class = "identifier" > C< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > E< / span > < span class = "special" > > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > when
< code class = "computeroutput" > < span class = "identifier" > C< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < / code > is < code class = "computeroutput" > < span class = "keyword" > true< / span > < / code > ,
for < code class = "computeroutput" > < span class = "identifier" > E< / span > < / code > otherwise.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.utility.mp_eval_if_c_b_t_f_u" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_eval_if_c_b_t_f_u" title = "mp_eval_if_c<B, T, F, U...>" > < code class = "computeroutput" > < span class = "identifier" > mp_eval_if_c< / span > < span class = "special" > < < / span > < span class = "identifier" > B< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span >
< span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > bool< / span > < span class = "identifier" > C< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > U< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_eval_if_c< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_eval_if_c< / span > < span class = "special" > < < / span > < span class = "identifier" > B< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span >
< span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > when
< code class = "computeroutput" > < span class = "identifier" > B< / span > < / code > is < code class = "computeroutput" > < span class = "keyword" > true< / span > < / code > ,
for < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code >
otherwise. Its purpose is to avoid evaluating < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > when the condition is < code class = "computeroutput" > < span class = "keyword" > true< / span > < / code > as it may not be valid in this case.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.utility.mp_eval_if_c_t_f_u" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_eval_if_c_t_f_u" title = "mp_eval_if<C, T, F, U...>" > < code class = "computeroutput" > < span class = "identifier" > mp_eval_if< / span > < span class = "special" > < < / span > < span class = "identifier" > C< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span >
< span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > C< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > U< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_eval_if< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_eval_if_c< / span > < span class = "special" > < < / span > < span class = "keyword" > static_cast< / span > < span class = "special" > < < / span > < span class = "keyword" > bool< / span > < span class = "special" > > (< / span > < span class = "identifier" > C< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > ),< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > U< / span > < span class = "special" > ...> ;< / span >
< / pre >
< p >
Like < code class = "computeroutput" > < span class = "identifier" > mp_eval_if_c< / span > < / code > , but
the first argument is a type.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.utility.mp_valid_f_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_valid_f_t" title = "mp_valid<F, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_valid< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_valid< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_valid< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > is an alias for < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code >
when < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code >
is a valid expression, for < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code >
otherwise.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.utility.mp_defer_f_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_defer_f_t" title = "mp_defer<F, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_defer< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_defer< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
When < code class = "computeroutput" > < span class = "identifier" > mp_valid< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > ,
< code class = "computeroutput" > < span class = "identifier" > mp_defer< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > is a struct with a nested type
< code class = "computeroutput" > < span class = "identifier" > type< / span > < / code > which is an alias
for < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > .
Otherwise, < code class = "computeroutput" > < span class = "identifier" > mp_defer< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > is an empty struct.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
2017-03-15 18:09:30 +02:00
< a name = "mp11.reference.utility.mp_quote_f_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_quote_f_t" title = "mp_quote<F, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_quote< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
2017-03-14 22:57:07 +02:00
< / h4 > < / div > < / div > < / div >
2017-03-15 18:09:30 +02:00
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > struct< / span > < span class = "identifier" > mp_quote< / span >
2017-03-14 22:57:07 +02:00
< span class = "special" > {< / span >
2017-03-20 16:23:52 +02:00
< span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > U< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > fn< / span > < span class = "special" > =< / span > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...,< / span > < span class = "identifier" > U< / span > < span class = "special" > ...> ;< / span >
2017-03-14 22:57:07 +02:00
< span class = "special" > };< / span >
< / pre >
< p >
2017-03-15 18:09:30 +02:00
< code class = "computeroutput" > < span class = "identifier" > mp_quote< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > transforms the template < code class = "computeroutput" > < span class = "identifier" > F< / span > < / code > into a type. In the common case < code class = "computeroutput" > < span class = "identifier" > mp_quote< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < / code > ,
2017-03-20 16:23:52 +02:00
the nested template < code class = "computeroutput" > < span class = "identifier" > fn< / span > < / code >
2017-03-15 18:09:30 +02:00
of the result is an alias for < code class = "computeroutput" > < span class = "identifier" > F< / span > < / code > ;
2017-03-20 16:23:52 +02:00
otherwise, < code class = "computeroutput" > < span class = "identifier" > fn< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code >
2017-03-15 18:09:30 +02:00
is an alias for < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...,< / span > < span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > ,
allowing partial application.
2017-03-14 22:57:07 +02:00
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
2017-03-17 01:39:52 +02:00
< a name = "mp11.reference.utility.mp_invoke_q_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_invoke_q_t" title = "mp_invoke<Q, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_invoke< / span > < span class = "special" > < < / span > < span class = "identifier" > Q< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
2017-03-14 22:57:07 +02:00
< / h4 > < / div > < / div > < / div >
2017-03-20 16:23:52 +02:00
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > Q< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_invoke< / span > < span class = "special" > =< / span > < span class = "keyword" > typename< / span > < span class = "identifier" > Q< / span > < span class = "special" > ::< / span > < span class = "keyword" > template< / span > < span class = "identifier" > fn< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> ;< / span >
2017-03-14 22:57:07 +02:00
< / pre >
< p >
2017-03-20 16:23:52 +02:00
< code class = "computeroutput" > < span class = "identifier" > mp_invoke< / span > < span class = "special" > < < / span > < span class = "identifier" > Q< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > evaluates the nested template < code class = "computeroutput" > < span class = "identifier" > fn< / span > < / code > of a quoted metafunction. < code class = "computeroutput" > < span class = "identifier" > mp_invoke< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_quote< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code >
2017-03-14 22:57:07 +02:00
is an alias for < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > .
2017-03-17 01:39:52 +02:00
< code class = "computeroutput" > < span class = "identifier" > mp_invoke< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_quote< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > is an alias for < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...,< / span > < span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > .
2017-03-14 22:57:07 +02:00
< / p >
< / div >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
< a name = "mp11.reference.algorithm" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm" title = "Algorithms, <boost/mp11/algorithm.hpp>" > Algorithms, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > /< / span > < span class = "identifier" > algorithm< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a >
< / h3 > < / div > < / div > < / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_assign_l1_l2" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_assign_l1_l2" title = "mp_assign<L1, L2>" > < code class = "computeroutput" > < span class = "identifier" > mp_assign< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / span > < span class = "special" > ,< / span > < span class = "identifier" > L2< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L1< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > L2< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_assign< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_assign< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ...> ,< / span >
< span class = "identifier" > L2< / span > < span class = "special" > < < / span > < span class = "identifier" > T2< / span > < span class = "special" > ...> > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > L1< / span > < span class = "special" > < < / span > < span class = "identifier" > T2< / span > < span class = "special" > ...> < / span > < / code > .
That is, it replaces the elements of < code class = "computeroutput" > < span class = "identifier" > L1< / span > < / code >
with those of < code class = "computeroutput" > < span class = "identifier" > L2< / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_clear_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_clear_l" title = "mp_clear<L>" > < code class = "computeroutput" > < span class = "identifier" > mp_clear< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_clear< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_assign< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < > > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_clear< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < > < / span > < / code > ,
that is, it removes the elements of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_transform_f_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_transform_f_l" title = "mp_transform<F, L...>" > < code class = "computeroutput" > < span class = "identifier" > mp_transform< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > L< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_transform< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_transform< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > L1< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > L2< / span > < span class = "special" > < < / span > < span class = "identifier" > T2< / span > < span class = "special" > ...> ,< / span > < span class = "special" > ...,< / span >
< span class = "identifier" > Ln< / span > < span class = "special" > < < / span > < span class = "identifier" > Tn< / span > < span class = "special" > ...> > < / span > < / code >
applies < code class = "computeroutput" > < span class = "identifier" > F< / span > < / code > to each successive
tuple of elements and returns < code class = "computeroutput" > < span class = "identifier" > L1< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > Tn< / span > < span class = "special" > > ...> < / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
2017-03-18 20:36:58 +02:00
< a name = "mp11.reference.algorithm.mp_transform_if_p_f_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_transform_if_p_f_l" title = "mp_transform_if<P, F, L...>" > < code class = "computeroutput" > < span class = "identifier" > mp_transform_if< / span > < span class = "special" > < < / span > < span class = "identifier" > P< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > L< / span > < span class = "special" > ...> < / span > < / code > < / a >
2017-03-14 22:57:07 +02:00
< / h4 > < / div > < / div > < / div >
2017-03-18 20:36:58 +02:00
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > P< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ...> < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_transform_if< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
2017-03-14 22:57:07 +02:00
< / pre >
2017-03-15 19:43:06 +02:00
< p >
2017-03-18 20:36:58 +02:00
< code class = "computeroutput" > < span class = "identifier" > mp_transform_if< / span > < span class = "special" > < < / span > < span class = "identifier" > P< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > L1< / span > < span class = "special" > ,< / span > < span class = "identifier" > L2< / span > < span class = "special" > ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > Ln< / span > < span class = "special" > > < / span > < / code >
replaces the elements < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code >
of the list < code class = "computeroutput" > < span class = "identifier" > L1< / span > < / code > for which
< code class = "computeroutput" > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > P< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > Tn< / span > < span class = "special" > > > < / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code >
with < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > Tn< / span > < span class = "special" > > < / span > < / code > , and returns the result, where < code class = "computeroutput" > < span class = "identifier" > Ti< / span > < / code > are the corresponding elements of
< code class = "computeroutput" > < span class = "identifier" > Li< / span > < / code > .
2017-03-15 19:43:06 +02:00
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_fill_l_v" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_fill_l_v" title = "mp_fill<L, V>" > < code class = "computeroutput" > < span class = "identifier" > mp_fill< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_fill< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_fill< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code >
returns < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > V< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > ,
with the result having the same size as the input.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_count_l_v" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_count_l_v" title = "mp_count<L, V>" > < code class = "computeroutput" > < span class = "identifier" > mp_count< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_count< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_count< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > returns < code class = "computeroutput" > < span class = "identifier" > mp_size_t< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > , where < code class = "computeroutput" > < span class = "identifier" > N< / span > < / code >
is the number of elements of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code >
same as < code class = "computeroutput" > < span class = "identifier" > V< / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_count_if_l_p" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_count_if_l_p" title = "mp_count_if<L, P>" > < code class = "computeroutput" > < span class = "identifier" > mp_count_if< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_count_if< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_count_f< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > returns < code class = "computeroutput" > < span class = "identifier" > mp_size_t< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > , where < code class = "computeroutput" > < span class = "identifier" > N< / span > < / code >
is the number of elements < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code >
of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > for which < code class = "computeroutput" > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > P< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_contains_l_v" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_contains_l_v" title = "mp_contains<L, V>" > < code class = "computeroutput" > < span class = "identifier" > mp_contains< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_contains< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_count< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_contains< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code >
when < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > contains an element
< code class = "computeroutput" > < span class = "identifier" > V< / span > < / code > , < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code >
otherwise.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_repeat_c_l_n" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_repeat_c_l_n" title = "mp_repeat_c<L, N>" > < code class = "computeroutput" > < span class = "identifier" > mp_repeat_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_repeat_c< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_repeat_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > returns a list of the same type as
< code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > that consists of < code class = "computeroutput" > < span class = "identifier" > N< / span > < / code > concatenated copies of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_repeat_l_n" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_repeat_l_n" title = "mp_repeat<L, N>" > < code class = "computeroutput" > < span class = "identifier" > mp_repeat< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_repeat< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
Same as < code class = "computeroutput" > < span class = "identifier" > mp_repeat_c< / span > < / code > but
with a type argument < code class = "computeroutput" > < span class = "identifier" > N< / span > < / code > .
The number of copies is < code class = "computeroutput" > < span class = "identifier" > N< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < / code >
and must be nonnegative.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_product_f_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_product_f_l" title = "mp_product<F, L...>" > < code class = "computeroutput" > < span class = "identifier" > mp_product< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > L< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_product< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_product< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > L1< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > L2< / span > < span class = "special" > < < / span > < span class = "identifier" > T2< / span > < span class = "special" > ...> ,< / span > < span class = "special" > ...,< / span >
< span class = "identifier" > Ln< / span > < span class = "special" > < < / span > < span class = "identifier" > Tn< / span > < span class = "special" > ...> > < / span > < / code >
evaluates < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > U1< / span > < span class = "special" > ,< / span > < span class = "identifier" > U2< / span > < span class = "special" > ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > Un< / span > < span class = "special" > > < / span > < / code > for values < code class = "computeroutput" > < span class = "identifier" > Ui< / span > < / code >
taken from the Cartesian product of the lists, as if the elements < code class = "computeroutput" > < span class = "identifier" > Ui< / span > < / code > are formed by < code class = "computeroutput" > < span class = "identifier" > n< / span > < / code >
nested loops, each traversing < code class = "computeroutput" > < span class = "identifier" > Li< / span > < / code > .
It returns a list of type < code class = "computeroutput" > < span class = "identifier" > L1< / span > < / code >
containing the results of the application of < code class = "computeroutput" > < span class = "identifier" > F< / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_drop_c_l_n" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_drop_c_l_n" title = "mp_drop_c<L, N>" > < code class = "computeroutput" > < span class = "identifier" > mp_drop_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_drop_c< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_drop_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > removes the first < code class = "computeroutput" > < span class = "identifier" > N< / span > < / code >
elements of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > and returns
the result.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_drop_l_n" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_drop_l_n" title = "mp_drop<L, N>" > < code class = "computeroutput" > < span class = "identifier" > mp_drop< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_drop< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
Same as < code class = "computeroutput" > < span class = "identifier" > mp_drop_c< / span > < / code > , but
with a type argument < code class = "computeroutput" > < span class = "identifier" > N< / span > < / code > .
< code class = "computeroutput" > < span class = "identifier" > N< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < / code > must be a nonnegative number.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
2017-03-15 19:43:06 +02:00
< a name = "mp11.reference.algorithm.mp_iota_c_n" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_iota_c_n" title = "mp_iota_c<N>" > < code class = "computeroutput" > < span class = "identifier" > mp_iota_c< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a >
2017-03-14 22:57:07 +02:00
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_iota_c< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_iota_c< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_size_t< / span > < span class = "special" > < < / span > < span class = "number" > 0< / span > < span class = "special" > > ,< / span >
< span class = "identifier" > mp_size_t< / span > < span class = "special" > < < / span > < span class = "number" > 1< / span > < span class = "special" > > ,< / span > < span class = "special" > ...,< / span >
< span class = "identifier" > mp_size_t< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > -< / span > < span class = "number" > 1< / span > < span class = "special" > > > < / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
2017-03-15 19:43:06 +02:00
< a name = "mp11.reference.algorithm.mp_iota_n" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_iota_n" title = "mp_iota<N>" > < code class = "computeroutput" > < span class = "identifier" > mp_iota< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a >
2017-03-14 22:57:07 +02:00
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_iota< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
Same as < code class = "computeroutput" > < span class = "identifier" > mp_iota_c< / span > < / code > , but
with a type argument < code class = "computeroutput" > < span class = "identifier" > N< / span > < / code > .
< code class = "computeroutput" > < span class = "identifier" > N< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < / code > must be a nonnegative number. Returns
< code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > integral_constant< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "number" > 0< / span > < span class = "special" > > ,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > integral_constant< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "number" > 1< / span > < span class = "special" > > ,< / span >
< span class = "special" > ...,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > integral_constant< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > -< / span > < span class = "number" > 1< / span > < span class = "special" > > > < / span > < / code >
where < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > is the type of
< code class = "computeroutput" > < span class = "identifier" > N< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_at_c_l_i" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_at_c_l_i" title = "mp_at_c<L, I>" > < code class = "computeroutput" > < span class = "identifier" > mp_at_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > I< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "identifier" > I< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_at_c< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_at_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > I< / span > < span class = "special" > > < / span > < / code > returns the < code class = "computeroutput" > < span class = "identifier" > I< / span > < / code > th
element of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > , zero-based.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_at_l_i" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_at_l_i" title = "mp_at<L, I>" > < code class = "computeroutput" > < span class = "identifier" > mp_at< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span >
< span class = "identifier" > I< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > I< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_at< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
Same as < code class = "computeroutput" > < span class = "identifier" > mp_at_c< / span > < / code > , but with
a type argument < code class = "computeroutput" > < span class = "identifier" > I< / span > < / code > . < code class = "computeroutput" > < span class = "identifier" > I< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < / code >
must be a nonnegative number.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_take_c_l_n" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_take_c_l_n" title = "mp_take_c<L, N>" > < code class = "computeroutput" > < span class = "identifier" > mp_take_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_take_c< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_take_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > returns a list of the same type as
< code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > containing the first
< code class = "computeroutput" > < span class = "identifier" > N< / span > < / code > elements of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_take_l_n" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_take_l_n" title = "mp_take<L, N>" > < code class = "computeroutput" > < span class = "identifier" > mp_take< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_take< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
Same as < code class = "computeroutput" > < span class = "identifier" > mp_take_c< / span > < / code > , but
with a type argument < code class = "computeroutput" > < span class = "identifier" > N< / span > < / code > .
< code class = "computeroutput" > < span class = "identifier" > N< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < / code > must be a nonnegative number.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_replace_l_v_w" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_replace_l_v_w" title = "mp_replace<L, V, W>" > < code class = "computeroutput" > < span class = "identifier" > mp_replace< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > ,< / span > < span class = "identifier" > W< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > V< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > W< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_replace< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
Replaces all < code class = "computeroutput" > < span class = "identifier" > V< / span > < / code > elements
of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > with < code class = "computeroutput" > < span class = "identifier" > W< / span > < / code > and returns the result.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_replace_if_l_p_w" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_replace_if_l_p_w" title = "mp_replace_if<L, P, W>" > < code class = "computeroutput" > < span class = "identifier" > mp_replace_if< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > ,< / span > < span class = "identifier" > W< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > P< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > W< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_replace_if< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
Replaces all < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > elements
of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > for which < code class = "computeroutput" > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > P< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > with < code class = "computeroutput" > < span class = "identifier" > W< / span > < / code > and returns the result.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
2017-03-18 20:36:58 +02:00
< a name = "mp11.reference.algorithm.mp_replace_at_c_l_i_w" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_replace_at_c_l_i_w" title = "mp_replace_at_c<L, I, W>" > < code class = "computeroutput" > < span class = "identifier" > mp_replace_at_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > I< / span > < span class = "special" > ,< / span > < span class = "identifier" > W< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "identifier" > I< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > W< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_replace_at_c< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
Replaces the element of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code >
at zero-based index < code class = "computeroutput" > < span class = "identifier" > I< / span > < / code > with
< code class = "computeroutput" > < span class = "identifier" > W< / span > < / code > and returns the result.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_replace_at_l_i_w" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_replace_at_l_i_w" title = "mp_replace_at<L, I, W>" > < code class = "computeroutput" > < span class = "identifier" > mp_replace_at< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > I< / span > < span class = "special" > ,< / span > < span class = "identifier" > W< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > I< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > W< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_replace_at< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
Same as < code class = "computeroutput" > < span class = "identifier" > mp_replace_at_c< / span > < / code > ,
but with a type argument < code class = "computeroutput" > < span class = "identifier" > I< / span > < / code > .
< code class = "computeroutput" > < span class = "identifier" > I< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < / code > must be a nonnegative number.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
2017-03-14 22:57:07 +02:00
< a name = "mp11.reference.algorithm.mp_copy_if_l_p" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_copy_if_l_p" title = "mp_copy_if<L, P>" > < code class = "computeroutput" > < span class = "identifier" > mp_copy_if< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_copy_if< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
Copies the elements < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > of
< code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > for which < code class = "computeroutput" > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > P< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > to a new list
of the same type and returns it.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_remove_l_v" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_remove_l_v" title = "mp_remove<L, V>" > < code class = "computeroutput" > < span class = "identifier" > mp_remove< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_remove< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
Removes all < code class = "computeroutput" > < span class = "identifier" > V< / span > < / code > elements
of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > and returns the result.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_remove_if_l_p" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_remove_if_l_p" title = "mp_remove_if<L, P>" > < code class = "computeroutput" > < span class = "identifier" > mp_remove_if< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_remove_if< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
Removes all elements < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code >
of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > for which < code class = "computeroutput" > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > P< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > and returns
the result.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_partition_l_p" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_partition_l_p" title = "mp_partition<L, P>" > < code class = "computeroutput" > < span class = "identifier" > mp_partition< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_partition< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_partition< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code >
partitions < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > into two lists
< code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > U1< / span > < span class = "special" > ...> < / span > < / code >
and < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > U2< / span > < span class = "special" > ...> < / span > < / code >
such that < code class = "computeroutput" > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > P< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > for the elements
of < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > U1< / span > < span class = "special" > ...> < / span > < / code >
and < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code > for the elements
of < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > U2< / span > < span class = "special" > ...> < / span > < / code > .
Returns < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > U1< / span > < span class = "special" > ...> ,< / span >
< span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > U2< / span > < span class = "special" > ...> > < / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_sort_l_p" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_sort_l_p" title = "mp_sort<L, P>" > < code class = "computeroutput" > < span class = "identifier" > mp_sort< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_sort< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 19:43:06 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_sort< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > sorts the list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code >
according to the strict weak ordering < code class = "computeroutput" > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > P< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > U< / span > < span class = "special" > > > < / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_find_l_v" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_find_l_v" title = "mp_find<L, V>" > < code class = "computeroutput" > < span class = "identifier" > mp_find< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
2017-03-15 20:19:36 +02:00
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_find< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
2017-03-14 22:57:07 +02:00
< / pre >
2017-03-15 20:19:36 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_find< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > is an alias for < code class = "computeroutput" > < span class = "identifier" > mp_size_t< / span > < span class = "special" > < < / span > < span class = "identifier" > I< / span > < span class = "special" > > < / span > < / code > , where < code class = "computeroutput" > < span class = "identifier" > I< / span > < / code >
is the zero-based index of the first occurence of < code class = "computeroutput" > < span class = "identifier" > V< / span > < / code >
in < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > . If < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > does not contain < code class = "computeroutput" > < span class = "identifier" > V< / span > < / code > ,
< code class = "computeroutput" > < span class = "identifier" > mp_find< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > mp_size< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_find_if_l_p" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_find_if_l_p" title = "mp_find_if<L, P>" > < code class = "computeroutput" > < span class = "identifier" > mp_find_if< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
2017-03-15 20:19:36 +02:00
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_find_if< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
2017-03-14 22:57:07 +02:00
< / pre >
2017-03-15 20:19:36 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_find_f< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > is an alias for < code class = "computeroutput" > < span class = "identifier" > mp_size_t< / span > < span class = "special" > < < / span > < span class = "identifier" > I< / span > < span class = "special" > > < / span > < / code > , where < code class = "computeroutput" > < span class = "identifier" > I< / span > < / code >
is the zero-based index of the first element < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code >
in < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > for which < code class = "computeroutput" > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > P< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > . If there is
no such element, < code class = "computeroutput" > < span class = "identifier" > mp_find< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_size< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_reverse_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_reverse_l" title = "mp_reverse<L>" > < code class = "computeroutput" > < span class = "identifier" > mp_reverse< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_reverse< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 20:19:36 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_reverse< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > Tn< / span > < span class = "special" > > > < / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > Tn< / span > < span class = "special" > ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "identifier" > T1< / span > < span class = "special" > > < / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_fold_l_v_f" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_fold_l_v_f" title = "mp_fold<L, V, F>" > < code class = "computeroutput" > < span class = "identifier" > mp_fold< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > V< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_fold< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 20:19:36 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_fold< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > Tn< / span > < span class = "special" > > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span >
< span class = "identifier" > F< / span > < span class = "special" > < < / span >
< span class = "identifier" > F< / span > < span class = "special" > < < / span >
< span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > V< / span > < span class = "special" > ,< / span > < span class = "identifier" > T1< / span > < span class = "special" > > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > > ,< / span > < span class = "special" > ...> ,< / span >
< span class = "identifier" > Tn< / span > < span class = "special" > > < / span > < / code > ,
or < code class = "computeroutput" > < span class = "identifier" > V< / span > < / code > , if < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > is empty.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_reverse_fold_l_v_f" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_reverse_fold_l_v_f" title = "mp_reverse_fold<L, V, F>" > < code class = "computeroutput" > < span class = "identifier" > mp_reverse_fold< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > V< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_reverse_fold< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 20:19:36 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_reverse_fold< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > Tn< / span > < span class = "special" > > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > < ...,< / span > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > Tn< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > > > > < / span > < / code > ,
or < code class = "computeroutput" > < span class = "identifier" > V< / span > < / code > , if < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > is empty.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_unique_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_unique_l" title = "mp_unique<L>" > < code class = "computeroutput" > < span class = "identifier" > mp_unique< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_unique< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
2017-03-15 20:19:36 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_unique< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > < / span > < / code >
returns a list of the same type as < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code >
with the duplicate elements removed.
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_all_of_l_p" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_all_of_l_p" title = "mp_all_of<L, P>" > < code class = "computeroutput" > < span class = "identifier" > mp_all_of< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_all_of< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_count_if< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > ==< / span > < span class = "identifier" > mp_size< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > > ;< / span >
< / pre >
2017-03-15 20:19:36 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_all_of< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code >
when < code class = "computeroutput" > < span class = "identifier" > P< / span > < / code > holds for all elements
of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > , < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code >
otherwise. When < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > is empty,
the result is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_none_of_l_p" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_none_of_l_p" title = "mp_none_of<L, P>" > < code class = "computeroutput" > < span class = "identifier" > mp_none_of< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_none_of< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_count_if< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > ==< / span > < span class = "number" > 0< / span > < span class = "special" > > ;< / span >
< / pre >
2017-03-15 20:19:36 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_none_of< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code >
when < code class = "computeroutput" > < span class = "identifier" > P< / span > < / code > holds for no element
of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > , < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code >
otherwise. When < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > is empty,
the result is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_any_of_l_p" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_any_of_l_p" title = "mp_any_of<L, P>" > < code class = "computeroutput" > < span class = "identifier" > mp_any_of< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_any_of< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_count_if< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > !=< / span > < span class = "number" > 0< / span > < span class = "special" > > ;< / span >
< / pre >
2017-03-15 20:19:36 +02:00
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_any_of< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > P< / span > < span class = "special" > > < / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code >
when < code class = "computeroutput" > < span class = "identifier" > P< / span > < / code > holds for at least
one element of < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > , < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code > otherwise. When < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > is empty, the result is < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code > .
< / p >
2017-03-14 22:57:07 +02:00
< / div >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
< a name = "mp11.reference.set" > < / a > < a class = "link" href = "mp11.html#mp11.reference.set" title = "Set Operations, <boost/mp11/set.hpp>" > Set Operations, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > /< / span > < span class = "identifier" > set< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a >
< / h3 > < / div > < / div > < / div >
< p >
A set is a list whose elements are unique.
< / p >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.set.mp_set_contains_s_v" > < / a > < a class = "link" href = "mp11.html#mp11.reference.set.mp_set_contains_s_v" title = "mp_set_contains<S, V>" > < code class = "computeroutput" > < span class = "identifier" > mp_set_contains< / span > < span class = "special" > < < / span > < span class = "identifier" > S< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > S< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_set_contains< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_set_contains< / span > < span class = "special" > < < / span > < span class = "identifier" > S< / span > < span class = "special" > ,< / span > < span class = "identifier" > V< / span > < span class = "special" > > < / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code >
if the type < code class = "computeroutput" > < span class = "identifier" > V< / span > < / code > is an element
of the set < code class = "computeroutput" > < span class = "identifier" > S< / span > < / code > , < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code > otherwise.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.set.mp_set_push_back_s_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.set.mp_set_push_back_s_t" title = "mp_set_push_back<S, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_set_push_back< / span > < span class = "special" > < < / span > < span class = "identifier" > S< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > S< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_set_push_back< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
For each < code class = "computeroutput" > < span class = "identifier" > T1< / span > < / code > in < code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < / code > ,
< code class = "computeroutput" > < span class = "identifier" > mp_set_push_back< / span > < span class = "special" > < < / span > < span class = "identifier" > S< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > appends < code class = "computeroutput" > < span class = "identifier" > T1< / span > < / code >
to the end of < code class = "computeroutput" > < span class = "identifier" > S< / span > < / code > if it's
not already an element of < code class = "computeroutput" > < span class = "identifier" > S< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.set.mp_set_push_front_s_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.set.mp_set_push_front_s_t" title = "mp_set_push_front<S, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_set_push_front< / span > < span class = "special" > < < / span > < span class = "identifier" > S< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > S< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_set_push_front< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_set_push_front< / span > < span class = "special" > < < / span > < span class = "identifier" > S< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > inserts at the front of < code class = "computeroutput" > < span class = "identifier" > S< / span > < / code > those elements of < code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < / code > for which < code class = "computeroutput" > < span class = "identifier" > S< / span > < / code >
does not already contain the same type.
< / p >
< / div >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
< a name = "mp11.reference.map" > < / a > < a class = "link" href = "mp11.html#mp11.reference.map" title = "Map Operations, <boost/mp11/map.hpp>" > Map Operations, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > /< / span > < span class = "identifier" > map< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a >
< / h3 > < / div > < / div > < / div >
< p >
A map is a list of lists, the inner lists having at least one element (the
key.) The keys of the map must be unique.
< / p >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.map.mp_map_find_m_k" > < / a > < a class = "link" href = "mp11.html#mp11.reference.map.mp_map_find_m_k" title = "mp_map_find<M, K>" > < code class = "computeroutput" > < span class = "identifier" > mp_map_find< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span >
< span class = "identifier" > K< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > K< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_map_find< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_map_find< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > K< / span > < span class = "special" > > < / span > < / code > is an alias for the element of the
map < code class = "computeroutput" > < span class = "identifier" > M< / span > < / code > with a key < code class = "computeroutput" > < span class = "identifier" > K< / span > < / code > , or for < code class = "computeroutput" > < span class = "keyword" > void< / span > < / code > ,
if there is no such element.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.map.mp_map_contains_m_k" > < / a > < a class = "link" href = "mp11.html#mp11.reference.map.mp_map_contains_m_k" title = "mp_map_contains<M, K>" > < code class = "computeroutput" > < span class = "identifier" > mp_map_contains< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > K< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > K< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_map_contains< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_not< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > is_same< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_map_find< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > K< / span > < span class = "special" > > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_map_contains< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > K< / span > < span class = "special" > > < / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > ,
if the map < code class = "computeroutput" > < span class = "identifier" > M< / span > < / code > contains an
element with a key < code class = "computeroutput" > < span class = "identifier" > K< / span > < / code > ,
< code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code > otherwise.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.map.mp_map_insert_m_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.map.mp_map_insert_m_t" title = "mp_map_insert<M, T>" > < code class = "computeroutput" > < span class = "identifier" > mp_map_insert< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_map_insert< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_if< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_map_contains< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > mp_first< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > > ,< / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > mp_push_back< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "special" > > ;< / span >
< / pre >
< p >
Inserts the element < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > into
the map < code class = "computeroutput" > < span class = "identifier" > M< / span > < / code > , if an element
with a key < code class = "computeroutput" > < span class = "identifier" > mp_first< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code >
is not already in < code class = "computeroutput" > < span class = "identifier" > M< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.map.mp_map_replace_m_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.map.mp_map_replace_m_t" title = "mp_map_replace<M, T>" > < code class = "computeroutput" > < span class = "identifier" > mp_map_replace< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_map_replace< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
If the map < code class = "computeroutput" > < span class = "identifier" > M< / span > < / code > does not contain
an element with a key < code class = "computeroutput" > < span class = "identifier" > mp_first< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > , inserts it (using < code class = "computeroutput" > < span class = "identifier" > mp_push_back< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > );
otherwise, replaces the existing element with < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.map.mp_map_update_m_t_f" > < / a > < a class = "link" href = "mp11.html#mp11.reference.map.mp_map_update_m_t_f" title = "mp_map_update<M, T, F>" > < code class = "computeroutput" > < span class = "identifier" > mp_map_update< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...> < / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_map_update< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
If the map < code class = "computeroutput" > < span class = "identifier" > M< / span > < / code > does not contain
an element with a key < code class = "computeroutput" > < span class = "identifier" > mp_first< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > , inserts it (using < code class = "computeroutput" > < span class = "identifier" > mp_push_back< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > );
otherwise, replaces the existing element < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > X< / span > < span class = "special" > ,< / span > < span class = "identifier" > Y< / span > < span class = "special" > ...> < / span > < / code >
with < code class = "computeroutput" > < span class = "identifier" > L< / span > < span class = "special" > < < / span > < span class = "identifier" > X< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > X< / span > < span class = "special" > ,< / span > < span class = "identifier" > Y< / span > < span class = "special" > ...> > < / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.map.mp_map_erase_m_k" > < / a > < a class = "link" href = "mp11.html#mp11.reference.map.mp_map_erase_m_k" title = "mp_map_erase<M, K>" > < code class = "computeroutput" > < span class = "identifier" > mp_map_erase< / span > < span class = "special" > < < / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "identifier" > K< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > M< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > K< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_map_erase< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
If the map < code class = "computeroutput" > < span class = "identifier" > M< / span > < / code > contains an
element with a key < code class = "computeroutput" > < span class = "identifier" > K< / span > < / code > , removes
it.
< / p >
< / div >
< / div >
2017-03-16 19:45:47 +02:00
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
< a name = "mp11.reference.function" > < / a > < a class = "link" href = "mp11.html#mp11.reference.function" title = "Helper Metafunctions, <boost/mp11/function.hpp>" > Helper Metafunctions, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > mp11< / span > < span class = "special" > /< / span > < span class = "identifier" > function< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a >
< / h3 > < / div > < / div > < / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.function.mp_and_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.function.mp_and_t" title = "mp_and<T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_and< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_and< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_and< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code >
is an alias for the first type < code class = "computeroutput" > < span class = "identifier" > U< / span > < / code >
in < code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < / code >
for which < code class = "computeroutput" > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code > . If no such
type exists, the last one is returned. < code class = "computeroutput" > < span class = "identifier" > mp_and< / span > < span class = "special" > < > < / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > .
Similar to < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > conjunction< / span > < / code > in C++17.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.function.mp_all_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.function.mp_all_t" title = "mp_all<T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_all< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_all< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_all< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > if < code class = "computeroutput" > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > for all types
< code class = "computeroutput" > < span class = "identifier" > U< / span > < / code > in < code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < / code > , < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code >
otherwise. Same as < code class = "computeroutput" > < span class = "identifier" > mp_and< / span > < / code > ,
but does not perform short-circuit evaluation. < code class = "computeroutput" > < span class = "identifier" > mp_and< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_false< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code > , but < code class = "computeroutput" > < span class = "identifier" > mp_all< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_false< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > < / span > < / code >
is an error because < code class = "computeroutput" > < span class = "keyword" > void< / span > < / code > does
not have a nested < code class = "computeroutput" > < span class = "identifier" > value< / span > < / code > .
The upside is that < code class = "computeroutput" > < span class = "identifier" > mp_all< / span > < / code >
is faster.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.function.mp_or_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.function.mp_or_t" title = "mp_or<T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_or< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_or< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_or< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code >
is an alias for the first type < code class = "computeroutput" > < span class = "identifier" > U< / span > < / code >
in < code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < / code >
for which < code class = "computeroutput" > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > . If no such
type exists, the last one is returned. < code class = "computeroutput" > < span class = "identifier" > mp_or< / span > < span class = "special" > < > < / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code > .
Similar to < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > disjunction< / span > < / code > in C++17.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.function.mp_any_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.function.mp_any_t" title = "mp_any<T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_any< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_any< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_any< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > if < code class = "computeroutput" > < span class = "identifier" > mp_to_bool< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > for any type
< code class = "computeroutput" > < span class = "identifier" > U< / span > < / code > in < code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < / code > , < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code >
otherwise. Same as < code class = "computeroutput" > < span class = "identifier" > mp_or< / span > < / code > ,
but does not perform short-circuit evaluation.
< / p >
< / div >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
< a name = "mp11.reference.integer_sequence" > < / a > < a class = "link" href = "mp11.html#mp11.reference.integer_sequence" title = "Integer Sequences, <boost/integer_sequence.hpp>" > Integer Sequences,
< code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > integer_sequence< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a >
< / h3 > < / div > < / div > < / div >
< p >
The contents of this header are defined in namespace < code class = "computeroutput" > < span class = "identifier" > boost< / span > < / code > .
< / p >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.integer_sequence.integer_sequence_t_i" > < / a > < a class = "link" href = "mp11.html#mp11.reference.integer_sequence.integer_sequence_t_i" title = "integer_sequence<T, I...>" > < code class = "computeroutput" > < span class = "identifier" > integer_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > I< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < span class = "identifier" > I< / span > < span class = "special" > > < / span > < span class = "keyword" > struct< / span > < span class = "identifier" > integer_sequence< / span >
< span class = "special" > {< / span >
< span class = "special" > };< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > integer_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > I< / span > < span class = "special" > ...> < / span > < / code > holds a sequence of integers of
type < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > . Same as C++14's
< code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > integer_sequence< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.integer_sequence.make_integer_sequence_t_n" > < / a > < a class = "link" href = "mp11.html#mp11.reference.integer_sequence.make_integer_sequence_t_n" title = "make_integer_sequence<T, N>" > < code class = "computeroutput" > < span class = "identifier" > make_integer_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > make_integer_sequence< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > make_integer_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > integer_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span > < span class = "number" > 0< / span > < span class = "special" > ,< / span >
< span class = "number" > 1< / span > < span class = "special" > ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > N< / span > < span class = "special" > -< / span > < span class = "number" > 1< / span > < span class = "special" > > < / span > < / code > .
Same as C++14's < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > make_integer_sequence< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.integer_sequence.index_sequence_i" > < / a > < a class = "link" href = "mp11.html#mp11.reference.integer_sequence.index_sequence_i" title = "index_sequence<I...>" > < code class = "computeroutput" > < span class = "identifier" > index_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > I< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "special" > ...< / span > < span class = "identifier" > I< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > index_sequence< / span > < span class = "special" > =< / span > < span class = "identifier" > integer_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "special" > ,< / span > < span class = "identifier" > I< / span > < span class = "special" > ...> ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > index_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > I< / span > < span class = "special" > ...> < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > integer_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > size_t< / span > < span class = "special" > ,< / span > < span class = "identifier" > I< / span > < span class = "special" > ...> < / span > < / code > .
Same as C++14's < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > index_sequence< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.integer_sequence.make_index_sequence_n" > < / a > < a class = "link" href = "mp11.html#mp11.reference.integer_sequence.make_index_sequence_n" title = "make_index_sequence<N>" > < code class = "computeroutput" > < span class = "identifier" > make_index_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > make_index_sequence< / span > < span class = "special" > =< / span > < span class = "identifier" > make_integer_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "special" > ,< / span > < span class = "identifier" > N< / span > < span class = "special" > > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > make_index_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > index_sequence< / span > < span class = "special" > < < / span > < span class = "number" > 0< / span > < span class = "special" > ,< / span > < span class = "number" > 1< / span > < span class = "special" > ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > N< / span > < span class = "special" > -< / span > < span class = "number" > 1< / span > < span class = "special" > > < / span > < / code > . Same as C++14's < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > make_index_sequence< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.integer_sequence.index_sequence_for_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.integer_sequence.index_sequence_for_t" title = "index_sequence_for<T...>" > < code class = "computeroutput" > < span class = "identifier" > index_sequence_for< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > index_sequence_for< / span > < span class = "special" > =< / span > < span class = "identifier" > make_integer_sequence< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "special" > ,< / span > < span class = "keyword" > sizeof< / span > < span class = "special" > ...(< / span > < span class = "identifier" > T< / span > < span class = "special" > )> ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > index_sequence_for< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > make_index_sequence< / span > < span class = "special" > < < / span > < span class = "keyword" > sizeof< / span > < span class = "special" > ...(< / span > < span class = "identifier" > T< / span > < span class = "special" > )> < / span > < / code > . Same as C++14's < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > index_sequence_for< / span > < / code > .
< / p >
< / div >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
< a name = "mp11.reference.tuple_for_each" > < / a > < a class = "link" href = "mp11.html#mp11.reference.tuple_for_each" title = 'A "for each" algorithm for tuple-like types, <boost/tuple_for_each.hpp>' > A "for each"
algorithm for tuple-like types, < code class = "computeroutput" > < span class = "special" > < < / span > < span class = "identifier" > boost< / span > < span class = "special" > /< / span > < span class = "identifier" > tuple_for_each< / span > < span class = "special" > .< / span > < span class = "identifier" > hpp< / span > < span class = "special" > > < / span > < / code > < / a >
< / h3 > < / div > < / div > < / div >
< p >
The contents of this header are defined in namespace < code class = "computeroutput" > < span class = "identifier" > boost< / span > < / code > .
< / p >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.tuple_for_each.tuple_for_each" > < / a > < a class = "link" href = "mp11.html#mp11.reference.tuple_for_each.tuple_for_each" title = "tuple_for_each" > < code class = "computeroutput" > < span class = "identifier" > tuple_for_each< / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > Tp< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < span class = "keyword" > constexpr< / span > < span class = "identifier" > F< / span > < span class = "identifier" > tuple_for_each< / span > < span class = "special" > (< / span > < span class = "identifier" > Tp< / span > < span class = "special" > & & < / span > < span class = "identifier" > tp< / span > < span class = "special" > ,< / span > < span class = "identifier" > F< / span > < span class = "special" > & & < / span > < span class = "identifier" > f< / span > < span class = "special" > );< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > tuple_for_each< / span > < span class = "special" > (< / span > < span class = "identifier" > tp< / span > < span class = "special" > ,< / span > < span class = "identifier" > f< / span > < span class = "special" > )< / span > < / code > applies
the function object < code class = "computeroutput" > < span class = "identifier" > f< / span > < / code > to
each element of < code class = "computeroutput" > < span class = "identifier" > tp< / span > < / code > by evaluating
the expression < code class = "computeroutput" > < span class = "identifier" > f< / span > < span class = "special" > (< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > get< / span > < span class = "special" > < < / span > < span class = "identifier" > J< / span > < span class = "special" > > (< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > forward< / span > < span class = "special" > < < / span > < span class = "identifier" > Tp< / span > < span class = "special" > > (< / span > < span class = "identifier" > tp< / span > < span class = "special" > )))< / span > < / code >
for < code class = "computeroutput" > < span class = "identifier" > J< / span > < / code > in 0..< code class = "computeroutput" > < span class = "identifier" > N< / span > < span class = "special" > -< / span > < span class = "number" > 1< / span > < / code > ,
where < code class = "computeroutput" > < span class = "identifier" > N< / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple_size< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > remove_reference_t< / span > < span class = "special" > < < / span > < span class = "identifier" > Tp< / span > < span class = "special" > > > ::< / span > < span class = "identifier" > value< / span > < / code > .
< / p >
< p >
Returns < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > forward< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > > (< / span > < span class = "identifier" > f< / span > < span class = "special" > )< / span > < / code > .
< / p >
< / div >
< / div >
2017-03-14 22:57:07 +02:00
< / div >
< / div >
< table xmlns:rev = "http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width = "100%" > < tr >
2017-03-24 14:26:31 +02:00
< td align = "left" > < p > < small > Last revised: March 24, 2017 at 12:24:11 GMT< / small > < / p > < / td >
2017-03-14 22:57:07 +02:00
< td align = "right" > < div class = "copyright-footer" > < / div > < / td >
< / tr > < / table >
< hr >
< div class = "spirit-nav" > < / div >
< / body >
< / html >