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 >
2017-05-22 17:32:54 +03:00
< link rel = "stylesheet" href = "../css/boostbook.css" type = "text/css" >
2017-03-14 22:57:07 +02:00
< 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 >
2017-05-19 02:43:47 +03:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.examples.writing_common_type_specializati" > Writing
< code class = "computeroutput" > < span class = "identifier" > common_type< / span > < / code > specializations< / a > < / span > < / dt >
2017-05-17 20:47:25 +03:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.examples.fixing_tuple_cat" > Fixing < code class = "computeroutput" > < span class = "identifier" > tuple_cat< / span > < / code > < / a > < / span > < / dt >
2017-03-17 05:55:27 +02:00
< 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-05-12 19:21:27 +03:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.list.mp_apply_q_q_l" > < code class = "computeroutput" > < span class = "identifier" > mp_apply_q< / span > < span class = "special" > < < / span > < span class = "identifier" > Q< / 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 >
2017-05-19 03:22:53 +03:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility.mp_if_c_c_t_e" > < code class = "computeroutput" > < span class = "identifier" > mp_if_c< / 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 >
2017-03-14 22:57:07 +02:00
< 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 >
2017-05-19 03:22:53 +03:00
< 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_c_t_f_u" > < code class = "computeroutput" > < span class = "identifier" > mp_eval_if_c< / 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 >
2017-03-14 22:57:07 +02:00
< 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 >
2017-05-19 03:22:53 +03:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility.mp_eval_if_q_c_t_q_u" > < code class = "computeroutput" > < span class = "identifier" > mp_eval_if_q< / 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" > Q< / span > < span class = "special" > ,< / span >
< span class = "identifier" > U< / 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.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-05-12 19:43:03 +03:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.utility.mp_quote_f" > < code class = "computeroutput" > < span class = "identifier" > mp_quote< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / 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-05-10 00:39:18 +03:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_transform_q_q_l" > < code class = "computeroutput" > < span class = "identifier" > mp_transform_q< / span > < span class = "special" > < < / span > < span class = "identifier" > Q< / 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 >
2017-05-13 21:07:54 +03:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_product_q_q_l" > < code class = "computeroutput" > < span class = "identifier" > mp_product_q< / span > < span class = "special" > < < / span > < span class = "identifier" > Q< / 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_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 >
2017-05-13 21:52:56 +03:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_insert_c_l_i_t" > < code class = "computeroutput" > < span class = "identifier" > mp_insert_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" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_insert_l_i_t" > < code class = "computeroutput" > < span class = "identifier" > mp_insert< / 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" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_erase_c_l_i_j" > < code class = "computeroutput" > < span class = "identifier" > mp_erase_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" > J< / span > < span class = "special" > > < / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_erase_l_i_j" > < code class = "computeroutput" > < span class = "identifier" > mp_erase< / 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" > J< / 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_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 >
2017-05-13 00:23:58 +03:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.algorithm.mp_for_each_l_f" > < code class = "computeroutput" > < span class = "identifier" > mp_for_each< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > (< / span > < span class = "identifier" > f< / 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.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 >
2017-05-18 14:20:58 +03:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.function.mp_same_t" > < code class = "computeroutput" > < span class = "identifier" > mp_same< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > < / a > < / span > < / dt >
2017-03-16 19:45:47 +02:00
< / dl > < / dd >
2017-04-01 19:46:45 +03:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.bind" > Bind, < 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" > bind< / 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.bind.mp_arg_i" > < code class = "computeroutput" > < span class = "identifier" > mp_arg< / 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.bind.1_9" > < code class = "computeroutput" > < span class = "identifier" > _1< / span > < / code > ,
..., < code class = "computeroutput" > < span class = "identifier" > _9< / span > < / code > < / a > < / span > < / dt >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.bind.mp_bind_f_t" > < code class = "computeroutput" > < span class = "identifier" > mp_bind< / 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-05-10 23:23:56 +03:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.bind.mp_bind_q_q_t" > < code class = "computeroutput" > < span class = "identifier" > mp_bind_q< / 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-05-10 00:39:18 +03:00
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.bind.mp_bind_front_f_t" > < code class = "computeroutput" > < span class = "identifier" > mp_bind_front< / 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.bind.mp_bind_front_q_q_t" > < code class = "computeroutput" > < span class = "identifier" > mp_bind_front_q< / 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 >
< dt > < span class = "section" > < a href = "mp11.html#mp11.reference.bind.mp_bind_back_f_t" > < code class = "computeroutput" > < span class = "identifier" > mp_bind_back< / 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.bind.mp_bind_back_q_q_t" > < code class = "computeroutput" > < span class = "identifier" > mp_bind_back_q< / 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-04-01 19:46:45 +03:00
< / dl > < / dd >
2017-03-16 19:45:47 +02:00
< 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
2017-03-25 03:02:59 +02:00
C++11 metaprogramming< / a > and < a href = "http://pdimov.com/cpp2/simple_cxx11_metaprogramming_2.html" target = "_top" > its
sequel< / a > . Reading these articles before proceeding with this documentation
is highly recommended.
2017-03-16 19:45:47 +02:00
< / 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-04-01 19:46:45 +03:00
A < span class = "emphasis" > < em > list< / em > < / span > is a — usually but not necessarily variadic — template
2017-03-17 05:55:27 +02:00
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-05-10 23:23:56 +03:00
member 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 >
2017-04-01 19:46:45 +03:00
< p >
A < span class = "emphasis" > < em > set< / em > < / span > is a list whose elements are unique.
< / p >
< p >
A < span class = "emphasis" > < em > map< / em > < / span > is a list of lists, the inner lists having at least
one element (the key.) The keys of the map must be unique. For example,
< / p >
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > M1< / 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 = "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" > int< / span > < span class = "special" > *> ,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > pair< / span > < span class = "special" > < < / span > < span class = "keyword" > float< / span > < span class = "special" > ,< / span > < span class = "keyword" > float< / span > < span class = "special" > *> ,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > pair< / span > < span class = "special" > < < / span > < span class = "keyword" > void< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > *> > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > M2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / 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 = "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 > < span class = "identifier" > mp_list< / 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 = "number" > 1< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 2< / span > < span class = "special" > ]> > ;< / span >
< / pre >
2017-03-17 05:55:27 +02:00
< / 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 >
2017-03-25 03:02:59 +02:00
< 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 = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > endl< / span > < span class = "special" > ;< / span >
2017-03-17 05:55:27 +02:00
< 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 >
2017-05-17 20:47:25 +03:00
< p >
How does it work?
< / p >
< 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" > L2< / span > < span class = "special" > > < / span > < / code >
calls < 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 > < / code > where < code class = "computeroutput" > < span class = "identifier" > T1< / span > < / code >
varies over the elements of < code class = "computeroutput" > < span class = "identifier" > L1< / span > < / code >
and < code class = "computeroutput" > < span class = "identifier" > T2< / span > < / code > varies over the elements
of < code class = "computeroutput" > < span class = "identifier" > L2< / span > < / code > , as if by executing
two nested loops. It then returns a list of these results, of the same type
as < code class = "computeroutput" > < span class = "identifier" > L1< / span > < / code > .
< / p >
< p >
In our case, both lists are the same < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < / code > ,
and < code class = "computeroutput" > < span class = "identifier" > F< / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < / code > ,
so < code class = "computeroutput" > < 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 > < / code > will get us < 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" > char< / span > < span class = "special" > ,< / span >
< span class = "keyword" > char< / span > < span class = "special" > > ,< / span >
< span class = "identifier" > mp_list< / 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" > mp_list< / 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 = "special" > ...,< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "keyword" > unsigned< / span > < span class = "keyword" > long< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "special" > > ,< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "keyword" > unsigned< / span > < span class = "keyword" > long< / span > < span class = "special" > ,< / span > < span class = "keyword" > unsigned< / span >
< span class = "keyword" > long< / span > < span class = "special" > > > < / span > < / code > .
< / p >
< p >
We then default-construct this tuple and pass it to < code class = "computeroutput" > < span class = "identifier" > tuple_for_each< / span > < / code > .
< 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 > calls < code class = "computeroutput" > < span class = "identifier" > f< / span > < / code >
for every tuple element; we use a (C++14) lambda that calls < code class = "computeroutput" > < span class = "identifier" > test_result< / span > < / code > . (In pure C++11, we'd need
to make < code class = "computeroutput" > < span class = "identifier" > test_result< / span > < / code > a function
object with a templated < code class = "computeroutput" > < span class = "keyword" > operator< / span > < span class = "special" > ()< / span > < / code > and pass that to < code class = "computeroutput" > < span class = "identifier" > tuple_for_each< / span > < / code >
directly.)
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
2017-05-19 02:43:47 +03:00
< a name = "mp11.examples.writing_common_type_specializati" > < / a > < a class = "link" href = "mp11.html#mp11.examples.writing_common_type_specializati" title = "Writing common_type specializations" > Writing
< code class = "computeroutput" > < span class = "identifier" > common_type< / span > < / code > specializations< / a >
< / h3 > < / div > < / div > < / div >
< p >
The standard trait < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > common_type< / span > < / code > , used to obtain a type to which
all of its arguments can convert without unnecessary loss of precision, can
be user-specialized when its default implementation (based on the ternary
< code class = "computeroutput" > < span class = "special" > ?:< / span > < / code > operator) is unsuitable.
< / p >
< p >
Let's write a < code class = "computeroutput" > < span class = "identifier" > common_type< / span > < / code >
specialization for two < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < / code >
arguments. For that, we need a metafunction that applies < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > common_type< / span > < / code >
to each pair of elements and gathers the results into a tuple:
< / p >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > Tp1< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > Tp2< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > common_tuple< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_transform< / 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" > Tp1< / span > < span class = "special" > ,< / span > < span class = "identifier" > Tp2< / span > < span class = "special" > > ;< / span >
< / pre >
< p >
then specialize < code class = "computeroutput" > < span class = "identifier" > common_type< / span > < / code >
to use it:
< / p >
< pre class = "programlisting" > < span class = "keyword" > namespace< / span > < span class = "identifier" > std< / 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" > T1< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > T2< / span > < span class = "special" > > < / span > < span class = "keyword" > struct< / span > < span class = "identifier" > common_type< / 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 = "identifier" > T1< / 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 = "identifier" > T2< / span > < span class = "special" > ...> > :< / span > < span class = "identifier" > mp_defer< / span > < span class = "special" > < < / span > < span class = "identifier" > common_tuple< / 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 = "identifier" > T1< / 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 = "identifier" > T2< / span > < span class = "special" > ...> > < / span >
< span class = "special" > {< / span >
< span class = "special" > };< / span >
< span class = "special" > }< / span > < span class = "comment" > // std< / span >
< / pre >
< p >
(There is no need to specialize < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > common_type< / span > < / code >
for more than two arguments - it takes care of synthesizing the appropriate
semantics from the binary case.)
< / p >
< p >
The subtlety here is the use of < code class = "computeroutput" > < span class = "identifier" > mp_defer< / span > < / code > .
We could have defined a nested < code class = "computeroutput" > < span class = "identifier" > type< / span > < / code >
to < code class = "computeroutput" > < span class = "identifier" > common_tuple< / 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 = "identifier" > T1< / 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 = "identifier" > T2< / span > < span class = "special" > ...> > < / span > < / code > , and it would still have worked
in all valid cases. By letting < code class = "computeroutput" > < span class = "identifier" > mp_defer< / span > < / code >
define < code class = "computeroutput" > < span class = "identifier" > type< / span > < / code > , though, we make
our specialization < span class = "emphasis" > < em > SFINAE-friendly< / em > < / span > .
< / p >
< p >
That is, when our < code class = "computeroutput" > < span class = "identifier" > common_tuple< / span > < / code >
causes a substitution failure instead of a hard error, < code class = "computeroutput" > < span class = "identifier" > mp_defer< / span > < / code >
will not define a nested < code class = "computeroutput" > < span class = "identifier" > type< / span > < / code > ,
and < code class = "computeroutput" > < span class = "identifier" > common_type_t< / span > < / code > , which
is defined as < code class = "computeroutput" > < span class = "keyword" > typename< / span > < span class = "identifier" > common_type< / span > < span class = "special" > < ...> ::< / span > < span class = "identifier" > type< / span > < / code > ,
will also cause a substitution failure.
< / p >
< p >
As another example, consider the hypothetical type < code class = "computeroutput" > < span class = "identifier" > expected< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ,< / span >
< span class = "identifier" > E< / span > < span class = "special" > ...> < / span > < / code >
that represents either a successful return with a value of < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > , or an unsucessful return with an error
code of some type in the list < code class = "computeroutput" > < span class = "identifier" > E< / span > < span class = "special" > ...< / span > < / code > . The common type of < code class = "computeroutput" > < span class = "identifier" > expected< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > E1< / span > < span class = "special" > ,< / span >
< span class = "identifier" > E2< / span > < span class = "special" > ,< / span > < span class = "identifier" > E3< / span > < span class = "special" > > < / span > < / code >
and < code class = "computeroutput" > < span class = "identifier" > expected< / span > < span class = "special" > < < / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "identifier" > E1< / span > < span class = "special" > ,< / span > < span class = "identifier" > E4< / span > < span class = "special" > ,< / span >
< span class = "identifier" > E5< / span > < span class = "special" > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > expected< / 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" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > > ,< / span >
< span class = "identifier" > E1< / span > < span class = "special" > ,< / span > < span class = "identifier" > E2< / span > < span class = "special" > ,< / span > < span class = "identifier" > E3< / span > < span class = "special" > ,< / span > < span class = "identifier" > E4< / span > < span class = "special" > ,< / span >
< span class = "identifier" > E5< / span > < span class = "special" > > < / span > < / code > .
That is, the possible return values are combined into their common type,
and we take the union of the set of error types.
< / p >
< p >
Therefore,
< / p >
< 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" > E1< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > E2< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > common_expected< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_rename< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_push_front< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_unique< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_append< / span > < span class = "special" > < < / span > < span class = "identifier" > E1< / span > < span class = "special" > ,< / span > < span class = "identifier" > E2< / 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" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > > > ,< / span > < span class = "identifier" > expected< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > namespace< / span > < span class = "identifier" > std< / 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 = "special" > ...< / span > < span class = "identifier" > E1< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > E2< / span > < span class = "special" > > < / span > < span class = "keyword" > struct< / span > < span class = "identifier" > common_type< / span > < span class = "special" > < < / span > < span class = "identifier" > expected< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > E1< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > expected< / span > < span class = "special" > < < / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "identifier" > E2< / span > < span class = "special" > ...> > :< / span > < span class = "identifier" > mp_defer< / span > < span class = "special" > < < / span > < span class = "identifier" > common_expected< / span > < span class = "special" > ,< / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > E1< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > ,< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > E2< / span > < span class = "special" > ...> > < / span >
< span class = "special" > {< / span >
< span class = "special" > };< / span >
< span class = "special" > }< / span > < span class = "comment" > // std< / span >
< / pre >
< p >
Here we've taken a different tack; instead of passing the < code class = "computeroutput" > < span class = "identifier" > expected< / span > < / code >
types to < code class = "computeroutput" > < span class = "identifier" > common_expected< / span > < / code > ,
we're passing the < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > types
and lists of the < code class = "computeroutput" > < span class = "identifier" > E< / span > < / code > types.
This makes our job easier. < code class = "computeroutput" > < span class = "identifier" > mp_unique< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_append< / span > < span class = "special" > < < / span > < span class = "identifier" > E1< / span > < span class = "special" > ,< / span > < span class = "identifier" > E2< / span > < span class = "special" > > > < / span > < / code >
gives us the concatenation of < code class = "computeroutput" > < span class = "identifier" > E1< / span > < / code >
and < code class = "computeroutput" > < span class = "identifier" > E2< / span > < / code > with the duplicates
removed; we then add < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > common_type_t< / span > < span class = "special" > < < / span > < span class = "identifier" > T1< / span > < span class = "special" > ,< / span > < span class = "identifier" > T2< / span > < span class = "special" > > < / span > < / code >
to the front via < code class = "computeroutput" > < span class = "identifier" > mp_push_front< / span > < / code > ;
and finally, we < code class = "computeroutput" > < span class = "identifier" > mp_rename< / span > < / code >
the resultant < code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < / code > to
< code class = "computeroutput" > < span class = "identifier" > expected< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
2017-05-17 20:47:25 +03:00
< a name = "mp11.examples.fixing_tuple_cat" > < / a > < a class = "link" href = "mp11.html#mp11.examples.fixing_tuple_cat" title = "Fixing tuple_cat" > Fixing < code class = "computeroutput" > < span class = "identifier" > tuple_cat< / span > < / code > < / a >
< / h3 > < / div > < / div > < / div >
< p >
The article < a href = "http://pdimov.com/cpp2/simple_cxx11_metaprogramming.html" target = "_top" > Simple
C++11 metaprogramming< / a > builds an implementation of the standard function
< code class = "computeroutput" > < span class = "identifier" > tuple_cat< / span > < / code > , with the end result
given below:
< / p >
< 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" > F< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_iota< / 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 = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > R< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > Is< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > Ks< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > Tp< / span > < span class = "special" > > < / span >
< span class = "identifier" > R< / span > < span class = "identifier" > tuple_cat_< / span > < span class = "special" > (< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > Is< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > Ks< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > Tp< / span > < span class = "identifier" > tp< / span > < span class = "special" > )< / 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" > get< / span > < span class = "special" > < < / span > < span class = "identifier" > Ks< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / 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" > Is< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > > (< / span > < span class = "identifier" > tp< / 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 = "special" > ...< / span > < span class = "identifier" > Tp< / span > < span class = "special" > ,< / span >
< span class = "keyword" > class< / span > < span class = "identifier" > R< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_append< / 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" > typename< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > remove_reference< / span > < span class = "special" > < < / span > < span class = "identifier" > Tp< / span > < span class = "special" > > ::< / span > < span class = "identifier" > type< / span > < span class = "special" > ...> > < / span >
< span class = "identifier" > R< / span > < span class = "identifier" > tuple_cat< / 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 = "special" > {< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "keyword" > const< / span > < span class = "identifier" > N< / span > < span class = "special" > =< / span > < span class = "keyword" > sizeof< / span > < span class = "special" > ...(< / span > < span class = "identifier" > Tp< / span > < span class = "special" > );< / span >
< span class = "comment" > // inner< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > list1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_rename< / span > < span class = "special" > < < / span > < span class = "keyword" > typename< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > remove_reference< / span > < span class = "special" > < < / span > < span class = "identifier" > Tp< / span > < span class = "special" > > ::< / span > < span class = "identifier" > type< / span > < span class = "special" > ,< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > > ...> ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > list2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_iota_c< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > list3< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_transform< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_fill< / span > < span class = "special" > ,< / span > < span class = "identifier" > list1< / span > < span class = "special" > ,< / span > < span class = "identifier" > list2< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > inner< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_apply< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_append< / span > < span class = "special" > ,< / span > < span class = "identifier" > list3< / span > < span class = "special" > > ;< / span >
< span class = "comment" > // outer< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > list4< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_transform< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > list1< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > outer< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_apply< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_append< / span > < span class = "special" > ,< / span > < span class = "identifier" > list4< / span > < span class = "special" > > ;< / span >
< span class = "comment" > //< / span >
< span class = "keyword" > return< / span > < span class = "identifier" > tuple_cat_< / span > < span class = "special" > < < / span > < span class = "identifier" > R< / span > < span class = "special" > > (< / span > < span class = "identifier" > inner< / span > < span class = "special" > (),< / span > < span class = "identifier" > outer< / span > < span class = "special" > (),< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > forward_as_tuple< / 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 > < span class = "special" > )< / span > < span class = "special" > );< / span >
< span class = "special" > }< / span >
< / pre >
< p >
This function, however, is not entirely correct, in that it doesn't handle
some cases properly. For example, trying to concatenate tuples containing
move-only elements such as < code class = "computeroutput" > < span class = "identifier" > unique_ptr< / span > < / code >
fails:
< / p >
< pre class = "programlisting" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > unique_ptr< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > > > < / span > < span class = "identifier" > t1< / 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 = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > unique_ptr< / span > < span class = "special" > < < / span > < span class = "keyword" > float< / span > < span class = "special" > > > < / span > < span class = "identifier" > t2< / span > < span class = "special" > ;< / span >
< span class = "keyword" > auto< / span > < span class = "identifier" > result< / span > < span class = "special" > =< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple_cat< / span > < span class = "special" > (< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > move< / span > < span class = "special" > (< / span > < span class = "identifier" > t1< / span > < span class = "special" > ),< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > move< / span > < span class = "special" > (< / span > < span class = "identifier" > t2< / span > < span class = "special" > )< / span > < span class = "special" > );< / span >
< / pre >
< p >
Trying to concatenate < code class = "computeroutput" > < span class = "keyword" > const< / span > < / code >
tuples fails:
< / p >
< pre class = "programlisting" > < 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" > const< / span > < span class = "identifier" > t1< / 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" > float< / span > < span class = "special" > > < / span > < span class = "keyword" > const< / span > < span class = "identifier" > t2< / span > < span class = "special" > ;< / span >
< span class = "keyword" > auto< / span > < span class = "identifier" > result< / span > < span class = "special" > =< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple_cat< / span > < span class = "special" > (< / span > < span class = "identifier" > t1< / span > < span class = "special" > ,< / span > < span class = "identifier" > t2< / span > < span class = "special" > );< / span >
< / pre >
< p >
And finally, the standard < code class = "computeroutput" > < span class = "identifier" > tuple_cat< / span > < / code >
is specified to work on arbitrary tuple-like types (that is, all types that
support < code class = "computeroutput" > < span class = "identifier" > tuple_size< / span > < / code > , < code class = "computeroutput" > < span class = "identifier" > tuple_element< / span > < / code > , and < code class = "computeroutput" > < span class = "identifier" > get< / span > < / code > ),
while our implementation only works with < code class = "computeroutput" > < span class = "identifier" > tuple< / span > < / code >
and < code class = "computeroutput" > < span class = "identifier" > pair< / span > < / code > . < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > array< / span > < / code > ,
for example, fails:
< / p >
< pre class = "programlisting" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > array< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "number" > 2< / span > < span class = "special" > > < / span > < span class = "identifier" > t1< / span > < span class = "special" > {< / span > < span class = "number" > 1< / span > < span class = "special" > ,< / span > < span class = "number" > 2< / span > < span class = "special" > };< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > array< / span > < span class = "special" > < < / span > < span class = "keyword" > float< / span > < span class = "special" > ,< / span > < span class = "number" > 3< / span > < span class = "special" > > < / span > < span class = "identifier" > t2< / span > < span class = "special" > {< / span > < span class = "number" > 3.0f< / span > < span class = "special" > ,< / span > < span class = "number" > 4.0f< / span > < span class = "special" > ,< / span > < span class = "number" > 5.0f< / span > < span class = "special" > };< / span >
2017-05-19 01:43:30 +03:00
< span class = "keyword" > auto< / span > < span class = "identifier" > result< / span > < span class = "special" > =< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple_cat< / span > < span class = "special" > (< / span > < span class = "identifier" > t1< / span > < span class = "special" > ,< / span > < span class = "identifier" > t2< / span > < span class = "special" > );< / span >
2017-05-17 20:47:25 +03:00
< / pre >
< p >
Let's fix these one by one. Support for move-only types is easy, if one knows
where to look. The problem is that < code class = "computeroutput" > < span class = "identifier" > Tp< / span > < / code >
that we're passing to the helper < code class = "computeroutput" > < span class = "identifier" > tuple_cat_< / span > < / code >
is (correctly) < code class = "computeroutput" > < span class = "identifier" > tuple< / span > < span class = "special" > < < / span > < span class = "identifier" > unique_ptr< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > > & & ,< / span >
< span class = "identifier" > unique_ptr< / span > < span class = "special" > < < / span > < span class = "keyword" > float< / span > < span class = "special" > > & & > < / span > < / code > ,
but < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > get< / span > < span class = "special" > < < / span > < span class = "number" > 0< / span > < span class = "special" > > (< / span > < span class = "identifier" > tp< / span > < span class = "special" > )< / span > < / code > still returns < code class = "computeroutput" > < span class = "identifier" > unique_ptr< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > > & < / span > < / code > ,
because < code class = "computeroutput" > < span class = "identifier" > tp< / span > < / code > is an lvalue.
This behavior is a bit surprising, but consistent with how rvalue reference
members are treated by the language.
< / p >
< p >
Long story short, we need < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > move< / span > < span class = "special" > (< / span > < span class = "identifier" > tp< / span > < span class = "special" > )< / span > < / code >
in < code class = "computeroutput" > < span class = "identifier" > tuple_cat_< / span > < / code > to make < code class = "computeroutput" > < span class = "identifier" > tp< / span > < / code > an rvalue:
< / p >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > R< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > Is< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > Ks< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > Tp< / span > < span class = "special" > > < / span >
< span class = "identifier" > R< / span > < span class = "identifier" > tuple_cat_< / span > < span class = "special" > (< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > Is< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > Ks< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > Tp< / span > < span class = "identifier" > tp< / span > < span class = "special" > )< / 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" > get< / span > < span class = "special" > < < / span > < span class = "identifier" > Ks< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / 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" > Is< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > > (< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > move< / span > < span class = "special" > (< / span > < span class = "identifier" > tp< / span > < span class = "special" > )))...< / span > < span class = "special" > };< / span >
< span class = "special" > }< / span >
< / pre >
< p >
Next, < code class = "computeroutput" > < span class = "keyword" > const< / span > < / code > -qualified tuples.
The issue here is that we're stripping references from the input tuples,
but not < code class = "computeroutput" > < span class = "keyword" > const< / span > < / code > . As a result,
we're trying to manipulate types such as < code class = "computeroutput" > < span class = "identifier" > tuple< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > > < / span >
< span class = "keyword" > const< / span > < / code > with Mp11 algorithms, and these
types do not fit the list concept. We just need to strip qualifiers as well,
by defining the useful < code class = "computeroutput" > < span class = "identifier" > remove_cv_ref< / span > < / code >
primitive that is inexplicably missing from the standard library:
< / p >
< 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" > remove_cv_ref< / span > < span class = "special" > =< / span > < span class = "keyword" > typename< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > remove_cv< / span > < span class = "special" > < < / span >
< span class = "keyword" > typename< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > remove_reference< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > ::< / span > < span class = "identifier" > type< / span > < span class = "special" > > ::< / span > < span class = "identifier" > type< / span > < span class = "special" > ;< / span >
< / pre >
< p >
and then by using < code class = "computeroutput" > < span class = "identifier" > remove_cv_ref< / span > < span class = "special" > < < / span > < span class = "identifier" > Tp< / span > < span class = "special" > > < / span > < / code > in place of < code class = "computeroutput" > < span class = "keyword" > typename< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > remove_reference< / span > < span class = "special" > < < / span > < span class = "identifier" > Tp< / span > < span class = "special" > > ::< / span > < span class = "identifier" > type< / span > < / code > :
< / p >
< pre class = "programlisting" > < span class = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > Tp< / span > < span class = "special" > ,< / span >
< span class = "keyword" > class< / span > < span class = "identifier" > R< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_append< / 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 = "identifier" > remove_cv_ref< / span > < span class = "special" > < < / span > < span class = "identifier" > Tp< / span > < span class = "special" > > ...> > < / span >
< span class = "identifier" > R< / span > < span class = "identifier" > tuple_cat< / 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 = "special" > {< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "keyword" > const< / span > < span class = "identifier" > N< / span > < span class = "special" > =< / span > < span class = "keyword" > sizeof< / span > < span class = "special" > ...(< / span > < span class = "identifier" > Tp< / span > < span class = "special" > );< / span >
< span class = "comment" > // inner< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > list1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_rename< / span > < span class = "special" > < < / span > < span class = "identifier" > remove_cv_ref< / span > < span class = "special" > < < / span > < span class = "identifier" > Tp< / span > < span class = "special" > > ,< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > > ...> ;< / span >
< span class = "comment" > // ...< / span >
< / pre >
< p >
Finally, tuple-like types. We've so far exploited the fact that < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > pair< / span > < / code >
and < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < / code > are valid Mp11 lists, but in general,
arbitrary tuple-like types aren't, so we need to convert them into such.
For that, we'll need to define a metafunction < code class = "computeroutput" > < span class = "identifier" > from_tuple_like< / span > < / code >
that will take an arbitrary tuple-like type and will return, in our case,
the corresponding < code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < / code > .
< / p >
< p >
Technically, a more principled approach would've been to return < code class = "computeroutput" > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple< / span > < / code > ,
but here < code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < / code > will prove
more convenient.
< / p >
< p >
What we need is, given a tuple-like type < code class = "computeroutput" > < span class = "identifier" > Tp< / span > < / code > ,
to obtain < 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" > tuple_element< / span > < span class = "special" > < < / span > < span class = "number" > 0< / span > < span class = "special" > ,< / span >
2017-05-19 01:43:30 +03:00
< span class = "identifier" > Tp< / span > < span class = "special" > > ::< / span > < span class = "identifier" > type< / span > < span class = "special" > ,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple_element< / span > < span class = "special" > < < / span > < span class = "number" > 1< / span > < span class = "special" > ,< / span >
< span class = "identifier" > Tp< / span > < span class = "special" > > ::< / span > < span class = "identifier" > type< / span > < span class = "special" > ,< / span > < span class = "special" > ...,< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple_element< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > -< / span > < span class = "number" > 1< / span > < span class = "special" > ,< / span > < span class = "identifier" > Tp< / span > < span class = "special" > > ::< / span > < span class = "identifier" > type< / span > < span class = "special" > > < / span > < / code > , where < code class = "computeroutput" > < span class = "identifier" > N< / span > < / code >
2017-05-17 20:47:25 +03:00
is < code class = "computeroutput" > < span class = "identifier" > tuple_size< / span > < span class = "special" > < < / span > < span class = "identifier" > Tp< / span > < span class = "special" > > ::< / span > < span class = "identifier" > value< / span > < / code > . Here's one way to do it:
< / p >
2017-05-19 01:43:30 +03: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" > class< / span > < span class = "identifier" > I< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > tuple_element< / span > < span class = "special" > =< / span > < span class = "keyword" > typename< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple_element< / span > < span class = "special" > < < / span > < span class = "identifier" > I< / 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" > type< / span > < span class = "special" > ;< / span >
2017-05-17 20:47:25 +03:00
< 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" > from_tuple_like< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_product< / span > < span class = "special" > < < / span > < span class = "identifier" > tuple_element< / span > < span class = "special" > ,< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > ,< / span > < span class = "identifier" > mp_iota< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple_size< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > > > ;< / span >
< / pre >
< p >
(< code class = "computeroutput" > < span class = "identifier" > mp_iota< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > < / span > < / code > is
an algorithm that returns an < code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < / code >
with elements < code class = "computeroutput" > < span class = "identifier" > mp_size_t< / span > < span class = "special" > < < / span > < span class = "number" > 0< / span > < span class = "special" > > < / span > < / code > , < code class = "computeroutput" > < span class = "identifier" > mp_size_t< / span > < span class = "special" > < < / span > < span class = "number" > 1< / span > < span class = "special" > > < / span > < / code > , ...,
< code class = "computeroutput" > < 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 >
< p >
Remember that < 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" > L2< / span > < span class = "special" > > < / span > < / code >
performs the equivalent of two nested loops over the elements of < code class = "computeroutput" > < span class = "identifier" > L1< / span > < / code > and < code class = "computeroutput" > < span class = "identifier" > L2< / span > < / code > ,
applying < code class = "computeroutput" > < span class = "identifier" > F< / span > < / code > to the two variables
and gathering the result. In our case < code class = "computeroutput" > < span class = "identifier" > L1< / span > < / code >
consists of the single element < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > ,
so only the second loop (over < code class = "computeroutput" > < span class = "identifier" > mp_iota< / 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 < code class = "computeroutput" > < span class = "identifier" > tuple_size< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < / code > ),
remains, and we get a list of the same type as < code class = "computeroutput" > < span class = "identifier" > L1< / span > < / code >
(an < code class = "computeroutput" > < span class = "identifier" > mp_list< / span > < / code > ) with contents
< code class = "computeroutput" > < span class = "identifier" > tuple_element< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / 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 > < / code > ,
< code class = "computeroutput" > < span class = "identifier" > tuple_element< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / 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 > < / code > ,
..., < code class = "computeroutput" > < span class = "identifier" > tuple_element< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / 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 >
< p >
For completeness's sake, here's another, more traditional way to achieve
the same result:
< / p >
< 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" > from_tuple_like< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_transform_q< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_bind_front< / span > < span class = "special" > < < / span > < span class = "identifier" > tuple_element< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > > ,< / span > < span class = "identifier" > mp_iota< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple_size< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > > > ;< / span >
< / pre >
< p >
With all these fixes applied, our fully operational < code class = "computeroutput" > < span class = "identifier" > tuple_cat< / span > < / code >
now looks like this:
< / p >
< 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" > F< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_iota< / 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 = "keyword" > template< / span > < span class = "special" > < < / span > < span class = "keyword" > class< / span > < span class = "identifier" > R< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > Is< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "special" > ...< / span > < span class = "identifier" > Ks< / span > < span class = "special" > ,< / span > < span class = "keyword" > class< / span > < span class = "identifier" > Tp< / span > < span class = "special" > > < / span >
< span class = "identifier" > R< / span > < span class = "identifier" > tuple_cat_< / span > < span class = "special" > (< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > Is< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > Ks< / span > < span class = "special" > ...> ,< / span > < span class = "identifier" > Tp< / span > < span class = "identifier" > tp< / span > < span class = "special" > )< / 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" > get< / span > < span class = "special" > < < / span > < span class = "identifier" > Ks< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / 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" > Is< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > > (< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > move< / span > < span class = "special" > (< / span > < span class = "identifier" > tp< / 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" > remove_cv_ref< / span > < span class = "special" > =< / span > < span class = "keyword" > typename< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > remove_cv< / span > < span class = "special" > < < / span >
< span class = "keyword" > typename< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > remove_reference< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > ::< / span > < span class = "identifier" > type< / span > < span class = "special" > > ::< / span > < span class = "identifier" > type< / span > < span class = "special" > ;< / span >
2017-05-19 01:43:30 +03:00
< 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" > I< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > tuple_element< / span > < span class = "special" > =< / span > < span class = "keyword" > typename< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple_element< / span > < span class = "special" > < < / span > < span class = "identifier" > I< / 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" > type< / span > < span class = "special" > ;< / span >
2017-05-17 20:47:25 +03:00
< 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" > from_tuple_like< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_product< / span > < span class = "special" > < < / span > < span class = "identifier" > tuple_element< / span > < span class = "special" > ,< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > ,< / span > < span class = "identifier" > mp_iota< / span > < span class = "special" > < < / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > tuple_size< / 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" > Tp< / span > < span class = "special" > ,< / span >
< span class = "keyword" > class< / span > < span class = "identifier" > R< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_append< / 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 = "identifier" > from_tuple_like< / span > < span class = "special" > < < / span > < span class = "identifier" > remove_cv_ref< / span > < span class = "special" > < < / span > < span class = "identifier" > Tp< / span > < span class = "special" > > > ...> > < / span >
< span class = "identifier" > R< / span > < span class = "identifier" > tuple_cat< / 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 = "special" > {< / span >
< span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "keyword" > const< / span > < span class = "identifier" > N< / span > < span class = "special" > =< / span > < span class = "keyword" > sizeof< / span > < span class = "special" > ...(< / span > < span class = "identifier" > Tp< / span > < span class = "special" > );< / span >
< span class = "comment" > // inner< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > list1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "identifier" > from_tuple_like< / span > < span class = "special" > < < / span > < span class = "identifier" > remove_cv_ref< / span > < span class = "special" > < < / span > < span class = "identifier" > Tp< / span > < span class = "special" > > > ...> ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > list2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_iota_c< / span > < span class = "special" > < < / span > < span class = "identifier" > N< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > list3< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_transform< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_fill< / span > < span class = "special" > ,< / span > < span class = "identifier" > list1< / span > < span class = "special" > ,< / span > < span class = "identifier" > list2< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > inner< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_apply< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_append< / span > < span class = "special" > ,< / span > < span class = "identifier" > list3< / span > < span class = "special" > > ;< / span >
< span class = "comment" > // outer< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > list4< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_transform< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > list1< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > outer< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_apply< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_append< / span > < span class = "special" > ,< / span > < span class = "identifier" > list4< / span > < span class = "special" > > ;< / span >
< span class = "comment" > //< / span >
< span class = "keyword" > return< / span > < span class = "identifier" > tuple_cat_< / span > < span class = "special" > < < / span > < span class = "identifier" > R< / span > < span class = "special" > > (< / span > < span class = "identifier" > inner< / span > < span class = "special" > (),< / span > < span class = "identifier" > outer< / span > < span class = "special" > (),< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > forward_as_tuple< / 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 > < span class = "special" > )< / span > < span class = "special" > );< / span >
< span class = "special" > }< / span >
< / pre >
2017-03-17 02:28:03 +02:00
< / 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-05-13 21:11:23 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > R< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_product_q< / 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 = "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 > .
2017-05-13 21:11:23 +03:00
(< code class = "computeroutput" > < span class = "identifier" > mp_product_q< / span > < / code > is the same
as < code class = "computeroutput" > < span class = "identifier" > mp_product< / span > < / code > , but for quoted
metafunctions such as our < code class = "computeroutput" > < span class = "identifier" > Qret< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < / code > .)
2017-03-17 05:55:27 +02:00
< / 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 >
2017-05-17 20:47:25 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > L1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_size< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / span > < span class = "special" > > ;< / span > < span class = "comment" > // mp_size_t< 0> < / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L2< / span > < span class = "special" > =< / span > < 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" > int< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_size< / span > < span class = "special" > < < / span > < span class = "identifier" > L2< / span > < span class = "special" > > ;< / span > < span class = "comment" > // mp_size_t< 2> < / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L3< / 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" > float< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R3< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_size< / span > < span class = "special" > < < / span > < span class = "identifier" > L3< / span > < span class = "special" > > ;< / span > < span class = "comment" > // mp_size_t< 1> < / span >
< / pre >
2017-03-14 22:57:07 +02:00
< / 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 >
2017-05-17 20:47:25 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > L1< / span > < span class = "special" > =< / span > < 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 >
< span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / span > < span class = "special" > > ;< / span > < span class = "comment" > // int< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L2< / 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" > float< / span > < span class = "special" > ,< / span > < span class = "keyword" > double< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "keyword" > double< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L2< / span > < span class = "special" > > ;< / span > < span class = "comment" > // float< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L3< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 1< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 2< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 3< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 4< / span > < span class = "special" > ]> ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R3< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L3< / span > < span class = "special" > > ;< / span > < span class = "comment" > // char[1]< / span >
< / pre >
2017-03-14 22:57:07 +02:00
< / 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 >
2017-05-17 20:47:25 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > L1< / 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" > float< / span > < span class = "special" > ,< / span > < span class = "keyword" > double< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "keyword" > double< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_pop_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / span > < span class = "special" > > ;< / span > < span class = "comment" > // std::tuple< double, long double> < / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "keyword" > void< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_pop_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L2< / span > < span class = "special" > > ;< / span > < span class = "comment" > // mp_list< > < / span >
< / pre >
2017-03-14 22:57:07 +02:00
< / 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 >
2017-05-17 20:47:25 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > L1< / span > < span class = "special" > =< / span > < 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 >
< span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_second< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / span > < span class = "special" > > ;< / span > < span class = "comment" > // float< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L2< / 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" > float< / span > < span class = "special" > ,< / span > < span class = "keyword" > double< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "keyword" > double< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_second< / span > < span class = "special" > < < / span > < span class = "identifier" > L2< / span > < span class = "special" > > ;< / span > < span class = "comment" > // double< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L3< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 1< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 2< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 3< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 4< / span > < span class = "special" > ]> ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R3< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_second< / span > < span class = "special" > < < / span > < span class = "identifier" > L3< / span > < span class = "special" > > ;< / span > < span class = "comment" > // char[2]< / span >
< / pre >
2017-03-14 22:57:07 +02:00
< / 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 >
2017-05-17 20:47:25 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > L1< / 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" > float< / span > < span class = "special" > ,< / span > < span class = "keyword" > double< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "keyword" > double< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_third< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / span > < span class = "special" > > ;< / span > < span class = "comment" > // long double< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 1< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 2< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 3< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 4< / span > < span class = "special" > ]> ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_third< / span > < span class = "special" > < < / span > < span class = "identifier" > L2< / span > < span class = "special" > > ;< / span > < span class = "comment" > // char[3]< / span >
< / pre >
2017-03-14 22:57:07 +02:00
< / 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 >
2017-05-17 20:47:25 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > L1< / 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" > double< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "keyword" > double< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_push_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / span > < span class = "special" > ,< / span > < span class = "keyword" > float< / span > < span class = "special" > > ;< / span > < span class = "comment" > // std::tuple< float, double, long double> < / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "keyword" > void< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_push_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L2< / span > < span class = "special" > ,< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 1< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 2< / span > < span class = "special" > ]> ;< / span > < span class = "comment" > // mp_list< char[1], char[2], void> < / span >
< / pre >
2017-03-14 22:57:07 +02:00
< / 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 >
2017-05-17 20:47:25 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > L1< / 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" > double< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "keyword" > double< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_push_back< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / span > < span class = "special" > ,< / span > < span class = "keyword" > float< / span > < span class = "special" > > ;< / span > < span class = "comment" > // std::tuple< double, long double, float> < / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "keyword" > void< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_push_back< / span > < span class = "special" > < < / span > < span class = "identifier" > L2< / span > < span class = "special" > ,< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 1< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 2< / span > < span class = "special" > ]> ;< / span > < span class = "comment" > // mp_list< void, char[1], char[2]> < / span >
< / pre >
2017-03-14 22:57:07 +02:00
< / 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 >
2017-05-17 20:47:25 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > L1< / span > < span class = "special" > =< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > pair< / span > < span class = "special" > < < / span > < span class = "keyword" > double< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "keyword" > double< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_rename< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / 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 = "comment" > // std::tuple< double, long double> < / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L2< / 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" > void< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_rename< / span > < span class = "special" > < < / span > < span class = "identifier" > L2< / span > < span class = "special" > ,< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > > ;< / span > < span class = "comment" > // mp_list< void> < / span >
< / pre >
2017-03-14 22:57:07 +02:00
< / 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 >
2017-05-12 19:21:27 +03:00
< 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 metafunction < 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_apply< / 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 >
2017-03-24 14:26:31 +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 > .
(< 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 >
2017-05-17 20:47:25 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > L1< / span > < span class = "special" > =< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > pair< / span > < span class = "special" > < < / span > < span class = "keyword" > double< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "keyword" > double< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_apply< / 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" > L1< / span > < span class = "special" > > ;< / span > < span class = "comment" > // std::is_same< double, long double> < / span >
< / pre >
2017-03-24 14:26:31 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
2017-05-12 19:21:27 +03:00
< a name = "mp11.reference.list.mp_apply_q_q_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.list.mp_apply_q_q_l" title = "mp_apply_q<Q, L>" > < code class = "computeroutput" > < span class = "identifier" > mp_apply_q< / span > < span class = "special" > < < / span > < span class = "identifier" > Q< / 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" > Q< / 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_q< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_apply< / span > < span class = "special" > < < / 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" > L< / span > < span class = "special" > > ;< / span >
< / pre >
< p >
Same as < code class = "computeroutput" > < span class = "identifier" > mp_apply< / span > < / code > , but takes
a quoted metafunction.
< / p >
2017-05-17 20:47:25 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > L1< / 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" > double< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "keyword" > double< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L2< / 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 = "keyword" > long< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_apply_q< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_bind_front< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_push_back< / 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 = "comment" > // std::tuple< double, long double, int, long> < / span >
< / pre >
2017-05-12 19:21:27 +03:00
< / 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 >
2017-05-17 20:47:25 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > L1< / 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" > double< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "keyword" > double< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L2< / 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 = "keyword" > using< / span > < span class = "identifier" > L3< / span > < span class = "special" > =< / span > < span class = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > pair< / span > < span class = "special" > < < / span > < span class = "keyword" > short< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L4< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_append< / 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 = "identifier" > L3< / span > < span class = "special" > ,< / span > < span class = "identifier" > L4< / span > < span class = "special" > > ;< / span > < span class = "comment" > // std::tuple< double, long double, int, short, long> < / span >
< / pre >
2017-03-14 22:57:07 +02:00
< / 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 >
2017-05-17 20:47:25 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > L1< / span > < span class = "special" > =< / span > < 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 >
< span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_replace_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > ;< / span > < span class = "comment" > // std::pair< void, float> < / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L2< / 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" > float< / span > < span class = "special" > ,< / span > < span class = "keyword" > double< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "keyword" > double< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_replace_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L2< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > ;< / span > < span class = "comment" > // std::tuple< void, double, long double> < / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L3< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 1< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 2< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 3< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 4< / span > < span class = "special" > ]> ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R3< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_replace_front< / span > < span class = "special" > < < / span > < span class = "identifier" > L3< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > ;< / span > < span class = "comment" > // mp_list< void, char[2], char[3], char[4]> ;< / span >
< / pre >
2017-03-18 20:36:58 +02:00
< / 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 >
2017-05-17 20:47:25 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > L1< / span > < span class = "special" > =< / span > < 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 >
< span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_replace_second< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > ;< / span > < span class = "comment" > // std::pair< int, void> < / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L2< / 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" > float< / span > < span class = "special" > ,< / span > < span class = "keyword" > double< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "keyword" > double< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_replace_second< / span > < span class = "special" > < < / span > < span class = "identifier" > L2< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > ;< / span > < span class = "comment" > // std::tuple< float, void, long double> < / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L3< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 1< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 2< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 3< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 4< / span > < span class = "special" > ]> ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R3< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_replace_second< / span > < span class = "special" > < < / span > < span class = "identifier" > L3< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > ;< / span > < span class = "comment" > // mp_list< char[1], void, char[3], char[4]> ;< / span >
< / pre >
2017-03-18 20:36:58 +02:00
< / 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 >
2017-05-17 20:47:25 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > L1< / 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" > float< / span > < span class = "special" > ,< / span > < span class = "keyword" > double< / span > < span class = "special" > ,< / span > < span class = "keyword" > long< / span > < span class = "keyword" > double< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_replace_third< / span > < span class = "special" > < < / span > < span class = "identifier" > L1< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > ;< / span > < span class = "comment" > // std::tuple< float, double, void> < / span >
< span class = "keyword" > using< / span > < span class = "identifier" > L2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_list< / span > < span class = "special" > < < / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 1< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 2< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 3< / span > < span class = "special" > ],< / span > < span class = "keyword" > char< / span > < span class = "special" > [< / span > < span class = "number" > 4< / span > < span class = "special" > ]> ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_replace_third< / span > < span class = "special" > < < / span > < span class = "identifier" > L2< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > ;< / span > < span class = "comment" > // mp_list< char[1], char[2], void, char[4]> ;< / span >
< / pre >
2017-03-18 20:36:58 +02:00
< / 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" >
2017-05-19 03:22:53 +03:00
< a name = "mp11.reference.utility.mp_if_c_c_t_e" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_if_c_c_t_e" title = "mp_if_c<C, T, E...>" > < code class = "computeroutput" > < span class = "identifier" > mp_if_c< / 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 >
2017-03-14 22:57:07 +02:00
< / h4 > < / div > < / div > < / div >
2017-05-18 14:59:46 +03:00
< 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 = "special" > ...< / 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 >
2017-03-14 22:57:07 +02:00
< / pre >
< p >
2017-05-18 14:59:46 +03:00
< code class = "computeroutput" > < span class = "identifier" > mp_if_c< / span > < span class = "special" > < < / span > < span class = "keyword" > true< / 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 > . < code class = "computeroutput" > < span class = "identifier" > mp_if_c< / span > < span class = "special" > < < / span > < span class = "keyword" > false< / 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" > E< / span > < / code > .
Otherwise, the result is a substitution failure.
2017-03-14 22:57:07 +02:00
< / p >
2017-05-18 14:59:46 +03:00
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > R1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_if_c< / span > < span class = "special" > < < / span > < span class = "keyword" > true< / span > < span class = "special" > ,< / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > ;< / span > < span class = "comment" > // int< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > R2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_if_c< / span > < span class = "special" > < < / span > < span class = "identifier" > flase< / span > < span class = "special" > ,< / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > ;< / span > < span class = "comment" > // void< / span >
< span class = "keyword" > template< / 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" > void_if_5< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_if_c< / span > < span class = "special" > < < / span > < span class = "identifier" > I< / span > < span class = "special" > ::< / span > < span class = "identifier" > value< / span > < span class = "special" > ==< / span > < span class = "number" > 5< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > ;< / span > < span class = "comment" > // `void` when `I::value` is 5, substitution failure otherwise< / span >
< / pre >
2017-03-14 22:57:07 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
2017-05-19 03:22:53 +03:00
< 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 >
2017-03-14 22:57:07 +02:00
< / h4 > < / div > < / div > < / div >
2017-05-19 03:22:53 +03:00
< 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 >
2017-03-14 22:57:07 +02:00
< / pre >
< p >
2017-05-18 14:59:46 +03:00
Like < code class = "computeroutput" > < span class = "identifier" > mp_if_c< / span > < / code > , but the first
argument is a type.
2017-03-14 22:57:07 +02:00
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
2017-05-19 03:22:53 +03:00
< a name = "mp11.reference.utility.mp_eval_if_c_c_t_f_u" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_eval_if_c_c_t_f_u" title = "mp_eval_if_c<C, T, F, U...>" > < code class = "computeroutput" > < span class = "identifier" > mp_eval_if_c< / 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 >
2017-03-14 22:57:07 +02:00
< 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 >
2017-05-19 03:22:53 +03:00
< code class = "computeroutput" > < span class = "identifier" > mp_eval_if_c< / 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 >
2017-03-14 22:57:07 +02:00
< span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code >
is an alias for < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code > when
2017-05-19 03:22:53 +03:00
< code class = "computeroutput" > < span class = "identifier" > C< / span > < / code > is < code class = "computeroutput" > < span class = "keyword" > true< / span > < / code > ,
2017-03-14 22:57:07 +02:00
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" >
2017-05-19 03:22:53 +03:00
< a name = "mp11.reference.utility.mp_eval_if_q_c_t_q_u" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_eval_if_q_c_t_q_u" title = "mp_eval_if_q<C, T, Q, U...>" > < code class = "computeroutput" > < span class = "identifier" > mp_eval_if_q< / 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" > Q< / 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" > class< / span > < span class = "identifier" > Q< / 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_q< / span > < span class = "special" > =< / span > < 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" > Q< / span > < span class = "special" > ::< / span > < span class = "keyword" > template< / span > < span class = "identifier" > fn< / 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< / span > < / code > , but takes
a quoted metafunction.
< / 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.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-05-12 19:43:03 +03:00
< a name = "mp11.reference.utility.mp_quote_f" > < / a > < a class = "link" href = "mp11.html#mp11.reference.utility.mp_quote_f" title = "mp_quote<F>" > < code class = "computeroutput" > < span class = "identifier" > mp_quote< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < / code > < / a >
2017-03-14 22:57:07 +02:00
< / h4 > < / div > < / div > < / div >
2017-05-12 19:43:03 +03: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" > struct< / span > < span class = "identifier" > mp_quote< / span >
2017-03-14 22:57:07 +02:00
< span class = "special" > {< / span >
2017-05-12 19:43:03 +03: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 = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> ;< / span >
2017-03-14 22:57:07 +02:00
< span class = "special" > };< / span >
< / pre >
< p >
2017-05-12 19:43:03 +03:00
< code class = "computeroutput" > < span class = "identifier" > mp_quote< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > > < / span > < / code >
transforms the template < code class = "computeroutput" > < span class = "identifier" > F< / span > < / code >
into a type with a nested template < code class = "computeroutput" > < span class = "identifier" > fn< / span > < / code >
such that < code class = "computeroutput" > < span class = "identifier" > fn< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code >
returns < code class = "computeroutput" > < 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
< / 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-05-12 19:43:03 +03:00
returns < code class = "computeroutput" > < 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
< / 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-05-10 00:39:18 +03:00
< a name = "mp11.reference.algorithm.mp_transform_q_q_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_transform_q_q_l" title = "mp_transform_q<Q, L...>" > < code class = "computeroutput" > < span class = "identifier" > mp_transform_q< / span > < span class = "special" > < < / span > < span class = "identifier" > Q< / 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" > Q< / 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_q< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_transform< / span > < span class = "special" > < < / 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" > L< / span > < span class = "special" > ...> ;< / span >
< / pre >
< p >
As < code class = "computeroutput" > < span class = "identifier" > mp_transform< / span > < / code > , but takes
a quoted metafunction.
< / p >
< / 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 >
2017-03-25 03:02:59 +02:00
replaces the elements 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 >
2017-03-18 20:36:58 +02:00
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" >
2017-05-13 21:07:54 +03:00
< a name = "mp11.reference.algorithm.mp_product_q_q_l" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_product_q_q_l" title = "mp_product_q<Q, L...>" > < code class = "computeroutput" > < span class = "identifier" > mp_product_q< / span > < span class = "special" > < < / span > < span class = "identifier" > Q< / 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" > Q< / 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_q< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_product< / span > < span class = "special" > < < / 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" > L< / span > < span class = "special" > ...> ;< / span >
< / pre >
< p >
As < code class = "computeroutput" > < span class = "identifier" > mp_product< / span > < / code > , but takes
a quoted metafunction.
< / 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_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" >
2017-05-13 21:52:56 +03:00
< a name = "mp11.reference.algorithm.mp_insert_c_l_i_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_insert_c_l_i_t" title = "mp_insert_c<L, I, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_insert_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" > 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 = "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 = "special" > ...< / span > < span class = "identifier" > T< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_insert_c< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_append< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_take_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" > mp_push_front< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_drop_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" > T< / span > < span class = "special" > ...> > ;< / span >
< / pre >
< p >
Inserts the elements < code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < / code > into the list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code >
at position < code class = "computeroutput" > < span class = "identifier" > I< / span > < / code > (a zero-based
index).
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_insert_l_i_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_insert_l_i_t" title = "mp_insert<L, I, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_insert< / 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" > 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" > I< / 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_insert< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_append< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_take< / 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" > mp_push_front< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_drop< / 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" > T< / span > < span class = "special" > ...> > ;< / span >
< / pre >
< p >
Same as < code class = "computeroutput" > < span class = "identifier" > mp_insert_c< / span > < / code > , but
with a type argument < code class = "computeroutput" > < span class = "identifier" > I< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_erase_c_l_i_j" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_erase_c_l_i_j" title = "mp_erase_c<L, I, J>" > < code class = "computeroutput" > < span class = "identifier" > mp_erase_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" > J< / 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 = "identifier" > std< / span > < span class = "special" > ::< / span > < span class = "identifier" > size_t< / span > < span class = "identifier" > J< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_erase< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_append< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_take_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" > mp_drop_c< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > J< / span > < span class = "special" > > > ;< / span >
< / pre >
< p >
Removes from the list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code >
the elements with indices from < code class = "computeroutput" > < span class = "identifier" > I< / span > < / code >
(inclusive) to < code class = "computeroutput" > < span class = "identifier" > J< / span > < / code > (exclusive).
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_erase_l_i_j" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_erase_l_i_j" title = "mp_erase<L, I, J>" > < code class = "computeroutput" > < span class = "identifier" > mp_erase< / 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" > J< / 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" > J< / span > < span class = "special" > > < / span > < span class = "keyword" > using< / span > < span class = "identifier" > mp_erase< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_append< / span > < span class = "special" > < < / span > < span class = "identifier" > mp_take< / 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" > mp_drop< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > ,< / span > < span class = "identifier" > J< / span > < span class = "special" > > > ;< / span >
< / pre >
< p >
Same as < code class = "computeroutput" > < span class = "identifier" > mp_erase_c< / span > < / code > , but
with a type arguments < code class = "computeroutput" > < span class = "identifier" > I< / span > < / code >
and < code class = "computeroutput" > < span class = "identifier" > J< / span > < / code > .
< / 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_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 >
2017-05-13 21:07:54 +03:00
< 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 > returns the index at which the type
< code class = "computeroutput" > < span class = "identifier" > V< / span > < / code > is located in the list
< code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > . It's 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 >
2017-03-15 20:19:36 +02:00
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
2017-03-25 03:02:59 +02:00
no such element, < 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 >
2017-03-15 20:19:36 +02:00
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 >
2017-05-13 00:23:58 +03:00
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.algorithm.mp_for_each_l_f" > < / a > < a class = "link" href = "mp11.html#mp11.reference.algorithm.mp_for_each_l_f" title = "mp_for_each<L>(f)" > < code class = "computeroutput" > < span class = "identifier" > mp_for_each< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / 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" > F< / span > < span class = "special" > > < / span > < span class = "keyword" > constexpr< / span > < span class = "identifier" > F< / span > < span class = "identifier" > mp_for_each< / 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" > mp_for_each< / span > < span class = "special" > < < / span > < span class = "identifier" > L< / span > < span class = "special" > > (< / span > < span class = "identifier" > f< / span > < span class = "special" > )< / span > < / code > calls
< code class = "computeroutput" > < span class = "identifier" > f< / span > < / code > with < code class = "computeroutput" > < span class = "identifier" > mp_identity< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > > ()< / span > < / code > for each element < code class = "computeroutput" > < span class = "identifier" > T< / span > < / code >
of the list < code class = "computeroutput" > < span class = "identifier" > L< / span > < / code > , in order.
< / 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 >
2017-03-14 22:57:07 +02:00
< / 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 >
2017-03-25 03:02:59 +02:00
< 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 >
2017-03-14 22:57:07 +02:00
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 >
2017-05-18 14:20:58 +03:00
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.function.mp_same_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.function.mp_same_t" title = "mp_same<T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_same< / 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_same< / span > < span class = "special" > =< / span > < span class = "comment" > /*...*/< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_same< / 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 all the types
in < code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < / code >
are the same type, < code class = "computeroutput" > < span class = "identifier" > mp_false< / span > < / code >
otherwise. < code class = "computeroutput" > < span class = "identifier" > mp_same< / span > < span class = "special" > < > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > mp_true< / span > < / code > .
< / p >
< / div >
2017-03-16 19:45:47 +02:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
2017-04-01 19:46:45 +03:00
< a name = "mp11.reference.bind" > < / a > < a class = "link" href = "mp11.html#mp11.reference.bind" title = "Bind, <boost/mp11/bind.hpp>" > Bind, < 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" > bind< / 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.bind.mp_arg_i" > < / a > < a class = "link" href = "mp11.html#mp11.reference.bind.mp_arg_i" title = "mp_arg<I>" > < code class = "computeroutput" > < span class = "identifier" > mp_arg< / 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 = "identifier" > I< / span > < span class = "special" > > < / span > < span class = "keyword" > struct< / span > < span class = "identifier" > mp_arg< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_arg< / span > < span class = "special" > < < / span > < span class = "identifier" > I< / span > < span class = "special" > > < / span > < / code >
is a quoted metafunction whose nested template < code class = "computeroutput" > < span class = "identifier" > fn< / span > < span class = "special" > < < / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > returns the < code class = "computeroutput" > < span class = "identifier" > I< / span > < / code > -th
zero-based element of < code class = "computeroutput" > < 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.bind.1_9" > < / a > < a class = "link" href = "mp11.html#mp11.reference.bind.1_9" title = "_1, ..., _9" > < code class = "computeroutput" > < span class = "identifier" > _1< / span > < / code > ,
..., < code class = "computeroutput" > < span class = "identifier" > _9< / span > < / code > < / a >
< / h4 > < / div > < / div > < / div >
< pre class = "programlisting" > < span class = "keyword" > using< / span > < span class = "identifier" > _1< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_arg< / span > < span class = "special" > < < / span > < span class = "number" > 0< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > _2< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_arg< / span > < span class = "special" > < < / span > < span class = "number" > 1< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > _3< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_arg< / span > < span class = "special" > < < / span > < span class = "number" > 2< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > _4< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_arg< / span > < span class = "special" > < < / span > < span class = "number" > 3< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > _5< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_arg< / span > < span class = "special" > < < / span > < span class = "number" > 4< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > _6< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_arg< / span > < span class = "special" > < < / span > < span class = "number" > 5< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > _7< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_arg< / span > < span class = "special" > < < / span > < span class = "number" > 6< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > _8< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_arg< / span > < span class = "special" > < < / span > < span class = "number" > 7< / span > < span class = "special" > > ;< / span >
< span class = "keyword" > using< / span > < span class = "identifier" > _9< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_arg< / span > < span class = "special" > < < / span > < span class = "number" > 8< / span > < span class = "special" > > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > _1< / span > < / code > to < code class = "computeroutput" > < span class = "identifier" > _9< / span > < / code >
are placeholder types, the equivalent to the placeholders of < code class = "computeroutput" > < span class = "identifier" > boost< / span > < span class = "special" > ::< / span > < span class = "identifier" > bind< / span > < / code > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.bind.mp_bind_f_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.bind.mp_bind_f_t" title = "mp_bind<F, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_bind< / 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" > struct< / span > < span class = "identifier" > mp_bind< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_bind< / 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 quoted metafunction that implements
the type-based equivalent of < code class = "computeroutput" > < span class = "identifier" > boost< / span > < span class = "special" > ::< / span > < span class = "identifier" > bind< / span > < / code > .
Its nested template < code class = "computeroutput" > < span class = "identifier" > fn< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > returns < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "identifier" > V< / span > < span class = "special" > ...> < / span > < / code > , where < code class = "computeroutput" > < span class = "identifier" > V< / span > < span class = "special" > ...< / span > < / code > is < code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < / code > with the placeholders replaced by the
corresponding element of < code class = "computeroutput" > < span class = "identifier" > U< / span > < span class = "special" > ...< / span > < / code > and the < code class = "computeroutput" > < span class = "identifier" > mp_bind< / span > < / code >
expressions replaced with their corresponding evaluations against < code class = "computeroutput" > < span class = "identifier" > U< / span > < span class = "special" > ...< / span > < / code > .
< / p >
< p >
For example, < code class = "computeroutput" > < span class = "identifier" > mp_bind< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "identifier" > _2< / span > < span class = "special" > ,< / span > < span class = "identifier" > mp_bind< / span > < span class = "special" > < < / span > < span class = "identifier" > G< / span > < span class = "special" > ,< / span > < span class = "identifier" > _1< / span > < span class = "special" > > > ::< / span > < span class = "identifier" > fn< / span > < span class = "special" > < < / span > < span class = "keyword" > float< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > > < / span > < / code >
is < code class = "computeroutput" > < span class = "identifier" > F< / span > < span class = "special" > < < / span > < span class = "keyword" > int< / span > < span class = "special" > ,< / span > < span class = "keyword" > void< / span > < span class = "special" > ,< / span > < span class = "identifier" > G< / span > < span class = "special" > < < / span > < span class = "keyword" > float< / span > < span class = "special" > > > < / span > < / code > .
< / p >
< / div >
2017-05-10 00:39:18 +03:00
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
2017-05-10 23:23:56 +03:00
< a name = "mp11.reference.bind.mp_bind_q_q_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.bind.mp_bind_q_q_t" title = "mp_bind_q<Q, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_bind_q< / 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 >
< / h4 > < / div > < / div > < / div >
< 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_bind_q< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_bind< / span > < span class = "special" > < < / 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 >
< / pre >
< p >
As < code class = "computeroutput" > < span class = "identifier" > mp_bind< / span > < / code > , but takes a
quoted metafunction.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
2017-05-10 00:39:18 +03:00
< a name = "mp11.reference.bind.mp_bind_front_f_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.bind.mp_bind_front_f_t" title = "mp_bind_front<F, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_bind_front< / 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" > struct< / span > < span class = "identifier" > mp_bind_front< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_bind_front< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > binds the leftmost arguments of
< code class = "computeroutput" > < span class = "identifier" > F< / span > < / code > to < code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < / code > . Its nested template < code class = "computeroutput" > < span class = "identifier" > fn< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > returns < 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 > .
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.bind.mp_bind_front_q_q_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.bind.mp_bind_front_q_q_t" title = "mp_bind_front_q<Q, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_bind_front_q< / 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 >
< / h4 > < / div > < / div > < / div >
< 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_bind_front_q< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_bind_front< / span > < span class = "special" > < < / 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 >
< / pre >
< p >
As < code class = "computeroutput" > < span class = "identifier" > mp_bind_front< / span > < / code > , but takes
a quoted metafunction.
< / p >
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h4 class = "title" >
< a name = "mp11.reference.bind.mp_bind_back_f_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.bind.mp_bind_back_f_t" title = "mp_bind_back<F, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_bind_back< / 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" > struct< / span > < span class = "identifier" > mp_bind_back< / span > < span class = "special" > ;< / span >
< / pre >
< p >
< code class = "computeroutput" > < span class = "identifier" > mp_bind_back< / span > < span class = "special" > < < / span > < span class = "identifier" > F< / span > < span class = "special" > ,< / span > < span class = "identifier" > T< / span > < span class = "special" > ...> < / span > < / code > binds the rightmost arguments of
< code class = "computeroutput" > < span class = "identifier" > F< / span > < / code > to < code class = "computeroutput" > < span class = "identifier" > T< / span > < span class = "special" > ...< / span > < / code > . Its nested template < code class = "computeroutput" > < span class = "identifier" > fn< / span > < span class = "special" > < < / span > < span class = "identifier" > U< / span > < span class = "special" > ...> < / span > < / code > returns < code class = "computeroutput" > < span class = "identifier" > F< / 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.bind.mp_bind_back_q_q_t" > < / a > < a class = "link" href = "mp11.html#mp11.reference.bind.mp_bind_back_q_q_t" title = "mp_bind_back_q<Q, T...>" > < code class = "computeroutput" > < span class = "identifier" > mp_bind_back_q< / 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 >
< / h4 > < / div > < / div > < / div >
< 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_bind_back_q< / span > < span class = "special" > =< / span > < span class = "identifier" > mp_bind_back< / span > < span class = "special" > < < / 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 >
< / pre >
< p >
As < code class = "computeroutput" > < span class = "identifier" > mp_bind_back< / span > < / code > , but takes
a quoted metafunction.
< / p >
< / div >
2017-04-01 19:46:45 +03:00
< / div >
< div class = "section" >
< div class = "titlepage" > < div > < div > < h3 class = "title" >
2017-03-16 19:45:47 +02:00
< 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-05-22 17:32:54 +03:00
< td align = "left" > < p > < small > Last revised: May 22, 2017 at 13:46:31 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 >