1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Functionality for "empty" seqs and tuples</title> 5<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../index.html" title="Chapter 1. The Variadic Macro Data Library 1.9"> 8<link rel="up" href="../vmd_useful.html" title="Useful variadic macros not in Boost PP"> 9<link rel="prev" href="vmd_identity.html" title="Generating emptiness and identity"> 10<link rel="next" href="../vmd_internal_macros.html" title="Controlling internal usage"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="vmd_identity.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../vmd_useful.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../vmd_internal_macros.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata"></a><a class="link" href="vmd_empty_ppdata.html" title='Functionality for "empty" seqs and tuples'>Functionality 28 for "empty" seqs and tuples</a> 29</h3></div></div></div> 30<p> 31 Boost PP arrays and lists can be empty but seqs and tuples cannot. The form 32 of an empty array is '(0,())' and the form of an empty list is 'BOOST_PP_NIL'. 33 But the form of '()' does not represent an empty seq or an empty tuple. Instead 34 for a seq it represents a one element seq whose data is empty, while for 35 a tuple it represents a tuple with a size of 1 whose single element is empty. 36 </p> 37<p> 38 Not having a way to represent an empty seq or tuple represents a small problem 39 for Boost PP users. For a tuple, especially, not being able to be "empty" 40 is the only reason, when variadic macros are supported, why an end-user might 41 prefer to use an array rather than a tuple as Boost PP preprocessor data. 42 Otherwise, when using variadic macros, using a tuple is easier to notate 43 and subsequently use than an array since no effort is needed to specify the 44 number of elements of a tuple. 45 </p> 46<p> 47 VMD as we have seen has functionality to tell when preprocessor data is "empty" 48 through its BOOST_VMD_IS_EMPTY macro. Because of this it is possible to treat 49 emptiness, when applied to a seq or tuple, as an empty seq or an empty tuple 50 respectively, thus allowing seqs and tuples to be empty, just as arrays and 51 lists are. 52 </p> 53<p> 54 However there is one large problem when treating emptiness as an empty seq 55 or empty tuple; Boost PP functionality for a seq or tuple knows nothing about 56 it. In other words if you passed emptiness to a Boost PP macro which expects 57 a seq or tuple, such as: 58 </p> 59<pre class="programlisting"><span class="identifier">BOOST_PP_SEQ_SIZE</span><span class="special">()</span> 60</pre> 61<p> 62 or 63 </p> 64<pre class="programlisting"><span class="identifier">BOOST_PP_TUPLE_PUSH_BACK</span><span class="special">(,</span><span class="number">1</span><span class="special">)</span> 65</pre> 66<p> 67 you would get UB, undefined behavior. 68 </p> 69<p> 70 In order to use seqs and tuples which can be empty VMD defines a number of 71 macros which mimic many of those in Boost PP, but begin with BOOST_VMD_ rather 72 than BOOST_PP_. The VMD macros work with what I will call a 'VMD seq' or 73 a 'VMD tuple', while the Boost PP equivalents work with the traditional seq 74 or tuple. A VMD seq is a seq which may be empty and a VMD tuple is a tuple 75 which may be empty. A VMD seq is therefore a superset of a normal seq and 76 a VMD tuple is therefore a superset of a normal tuple. The VMD functionality 77 therefore can accept a VMD seq or tuple or a normal seq or tuple whereas 78 the equivalent Boost PP functionality only accepts a normal seq or tuple. 79 To be more more precise the Boost PP functionality can accept a VMD seq or 80 a VMD tuple as long as it is not empty. In other words there is no difference 81 between a non-empty VMD seq or a Boost PP seq, or between a non-empty VMD 82 tuple and a Boost PP tuple. 83 </p> 84<p> 85 The particular macros which VMD supplies, supporting VMD seqs and VMD tuples, 86 are divided between array, list, seq, and tuple functionality. The actual 87 header files for these macros are in sub-directories of the VMD directory, 88 which start respectively with 'array','list','seq' and 'tuple'. The header 89 files are all also included in the general boost/vmd/vmd.hpp header file. 90 </p> 91<h5> 92<a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata.h0"></a> 93 <span class="phrase"><a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata.array_macros"></a></span><a class="link" href="vmd_empty_ppdata.html#variadic_macro_data.vmd_useful.vmd_empty_ppdata.array_macros">Array 94 macros</a> 95 </h5> 96<p> 97 The array macros provide conversions from an array to a VMD seq or a VMD 98 tuple. The array macros are: 99 </p> 100<div class="table"> 101<a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata.vpp_array"></a><p class="title"><b>Table 1.2. Array macros</b></p> 102<div class="table-contents"><table class="table" summary="Array macros"> 103<colgroup> 104<col> 105<col> 106<col> 107<col> 108<col> 109</colgroup> 110<thead><tr> 111<th> 112 <p> 113 Macro 114 </p> 115 </th> 116<th> 117 <p> 118 Parameter 119 </p> 120 </th> 121<th> 122 <p> 123 Return 124 </p> 125 </th> 126<th> 127 <p> 128 Functionality 129 </p> 130 </th> 131<th> 132 <p> 133 Header 134 </p> 135 </th> 136</tr></thead> 137<tbody> 138<tr> 139<td> 140 <p> 141 BOOST_VMD_ARRAY_TO_SEQ 142 </p> 143 </td> 144<td> 145 <p> 146 array = a Boost PP array 147 </p> 148 </td> 149<td> 150 <p> 151 A VMD seq 152 </p> 153 </td> 154<td> 155 <p> 156 Converts an array to a VMD seq. If the array is empty the seq is 157 empty, otherwise the conversion is the same as BOOST_PP_ARRAY_TO_SEQ 158 </p> 159 </td> 160<td> 161 <p> 162 boost/vmd/array/to_seq.hpp 163 </p> 164 </td> 165</tr> 166<tr> 167<td> 168 <p> 169 BOOST_VMD_ARRAY_TO_TUPLE 170 </p> 171 </td> 172<td> 173 <p> 174 array = a Boost PP array 175 </p> 176 </td> 177<td> 178 <p> 179 A VMD tuple 180 </p> 181 </td> 182<td> 183 <p> 184 Converts an array to a VMD tuple. If the array is empty the tuple 185 is empty, otherwise the conversion is the same as BOOST_PP_ARRAY_TO_TUPLE 186 </p> 187 </td> 188<td> 189 <p> 190 boost/vmd/array/to_tuple.hpp 191 </p> 192 </td> 193</tr> 194</tbody> 195</table></div> 196</div> 197<br class="table-break"><p> 198 The difference between the array conversion macros and their equivalent ones 199 in Boost PP is that if the array is empty the VMD macros return emptiness 200 whereas the Boost PP macros have UB. 201 </p> 202<p> 203 You can include the array macros either using their individual header files, 204 the general 'boost/vmd/array.hpp' header file for all array macros, or the 205 general header file 'boost/vmd/vmd.hpp' for all macros. 206 </p> 207<h5> 208<a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata.h1"></a> 209 <span class="phrase"><a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata.list_macros"></a></span><a class="link" href="vmd_empty_ppdata.html#variadic_macro_data.vmd_useful.vmd_empty_ppdata.list_macros">List 210 macros</a> 211 </h5> 212<p> 213 The list macros provide conversions from a list to a VMD seq or a VMD tuple. 214 The list macros are: 215 </p> 216<div class="table"> 217<a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata.vpp_list"></a><p class="title"><b>Table 1.3. List macros</b></p> 218<div class="table-contents"><table class="table" summary="List macros"> 219<colgroup> 220<col> 221<col> 222<col> 223<col> 224<col> 225</colgroup> 226<thead><tr> 227<th> 228 <p> 229 Macro 230 </p> 231 </th> 232<th> 233 <p> 234 Parameter 235 </p> 236 </th> 237<th> 238 <p> 239 Return 240 </p> 241 </th> 242<th> 243 <p> 244 Functionality 245 </p> 246 </th> 247<th> 248 <p> 249 Header 250 </p> 251 </th> 252</tr></thead> 253<tbody> 254<tr> 255<td> 256 <p> 257 BOOST_VMD_LIST_TO_SEQ 258 </p> 259 </td> 260<td> 261 <p> 262 list = a Boost PP list 263 </p> 264 </td> 265<td> 266 <p> 267 A VMD seq 268 </p> 269 </td> 270<td> 271 <p> 272 Converts a list to a VMD seq. If the list is empty the seq is empty, 273 otherwise the conversion is the same as BOOST_PP_LIST_TO_SEQ 274 </p> 275 </td> 276<td> 277 <p> 278 boost/vmd/list/to_seq.hpp 279 </p> 280 </td> 281</tr> 282<tr> 283<td> 284 <p> 285 BOOST_VMD_LIST_TO_TUPLE 286 </p> 287 </td> 288<td> 289 <p> 290 list = a Boost PP list 291 </p> 292 </td> 293<td> 294 <p> 295 A VMD tuple 296 </p> 297 </td> 298<td> 299 <p> 300 Converts a list to a VMD tuple. If the list is empty the tuple 301 is empty, otherwise the conversion is the same as BOOST_PP_LIST_TO_TUPLE 302 </p> 303 </td> 304<td> 305 <p> 306 boost/vmd/list/to_tuple.hpp 307 </p> 308 </td> 309</tr> 310</tbody> 311</table></div> 312</div> 313<br class="table-break"><p> 314 The difference between the list conversion macros and their equivalent ones 315 in Boost PP is that if the list is empty the VMD macros return emptiness 316 whereas the Boost PP macros have UB. 317 </p> 318<p> 319 You can include the list macros either using their individual header files, 320 the general 'boost/vmd/list.hpp' header file for all list macros, or the 321 general header file 'boost/vmd/vmd.hpp' for all macros. 322 </p> 323<h5> 324<a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata.h2"></a> 325 <span class="phrase"><a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata.seq_macros"></a></span><a class="link" href="vmd_empty_ppdata.html#variadic_macro_data.vmd_useful.vmd_empty_ppdata.seq_macros">Seq 326 macros</a> 327 </h5> 328<p> 329 The seq macros either work with a VMD seq or return A VMD seq. The seq macros 330 are: 331 </p> 332<div class="table"> 333<a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata.vpp_seq"></a><p class="title"><b>Table 1.4. Seq macros</b></p> 334<div class="table-contents"><table class="table" summary="Seq macros"> 335<colgroup> 336<col> 337<col> 338<col> 339<col> 340<col> 341</colgroup> 342<thead><tr> 343<th> 344 <p> 345 Macro 346 </p> 347 </th> 348<th> 349 <p> 350 Parameter 351 </p> 352 </th> 353<th> 354 <p> 355 Return 356 </p> 357 </th> 358<th> 359 <p> 360 Functionality 361 </p> 362 </th> 363<th> 364 <p> 365 Header 366 </p> 367 </th> 368</tr></thead> 369<tbody> 370<tr> 371<td> 372 <p> 373 BOOST_VMD_IS_VMD_SEQ 374 </p> 375 </td> 376<td> 377 <p> 378 sequence = a VMD sequence 379 </p> 380 </td> 381<td> 382 <p> 383 1 if the VMD sequence is a VMD seq, else 0 384 </p> 385 </td> 386<td> 387 <p> 388 Tests a sequence as a VMD seq. If the sequence is empty returns 389 1, otherwise returns the same as BOOST_VMD_IS_SEQ 390 </p> 391 </td> 392<td> 393 <p> 394 boost/vmd/seq/is_vmd_seq.hpp 395 </p> 396 </td> 397</tr> 398<tr> 399<td> 400 <p> 401 BOOST_VMD_SEQ_POP_BACK 402 </p> 403 </td> 404<td> 405 <p> 406 seq = a Boost PP seq 407 </p> 408 </td> 409<td> 410 <p> 411 A VMD seq 412 </p> 413 </td> 414<td> 415 <p> 416 Pops an element from the end of a seq. If the seq has a single 417 element returns an empty seq, otherwise works exactly the same 418 as BOOST_PP_SEQ_POP_BACK 419 </p> 420 </td> 421<td> 422 <p> 423 boost/vmd/seq/pop_back.hpp 424 </p> 425 </td> 426</tr> 427<tr> 428<td> 429 <p> 430 BOOST_VMD_SEQ_POP_FRONT 431 </p> 432 </td> 433<td> 434 <p> 435 seq = a Boost PP seq 436 </p> 437 </td> 438<td> 439 <p> 440 A VMD seq 441 </p> 442 </td> 443<td> 444 <p> 445 Pops an element from the beginning of a seq. If the seq has a single 446 element returns an empty seq, otherwise works exactly the same 447 as BOOST_PP_SEQ_POP_FRONT 448 </p> 449 </td> 450<td> 451 <p> 452 boost/vmd/seq/pop_front.hpp 453 </p> 454 </td> 455</tr> 456<tr> 457<td> 458 <p> 459 BOOST_VMD_SEQ_PUSH_BACK 460 </p> 461 </td> 462<td> 463 <p> 464 seq = a VMD seq, elem = element to push onto the end of the VMD 465 seq 466 </p> 467 </td> 468<td> 469 <p> 470 A Boost PP seq 471 </p> 472 </td> 473<td> 474 <p> 475 Pushes an element onto the end of a VMD seq. If the VMD seq is 476 empty the returned seq consists of that element, otherwise works 477 exactly the same as BOOST_PP_SEQ_PUSH_BACK 478 </p> 479 </td> 480<td> 481 <p> 482 boost/vmd/seq/push_back.hpp 483 </p> 484 </td> 485</tr> 486<tr> 487<td> 488 <p> 489 BOOST_VMD_SEQ_PUSH_FRONT 490 </p> 491 </td> 492<td> 493 <p> 494 seq = a VMD seq, elem = element to push onto the beginning of the 495 VMD seq 496 </p> 497 </td> 498<td> 499 <p> 500 A Boost PP seq 501 </p> 502 </td> 503<td> 504 <p> 505 Pushes an element onto the beginning of a VMD seq. If the VMD seq 506 is empty the returned seq consists of that element, otherwise works 507 exactly the same as BOOST_PP_SEQ_PUSH_FRONT 508 </p> 509 </td> 510<td> 511 <p> 512 boost/vmd/seq/push_front.hpp 513 </p> 514 </td> 515</tr> 516<tr> 517<td> 518 <p> 519 BOOST_VMD_SEQ_REMOVE 520 </p> 521 </td> 522<td> 523 <p> 524 seq = a Boost PP seq, i = index of element to remove 525 </p> 526 </td> 527<td> 528 <p> 529 A VMD seq 530 </p> 531 </td> 532<td> 533 <p> 534 Removes an element from a Boost PP seq. If the seq has a single 535 element and the index to be removed is 0 returns an empty seq, 536 otherwise works exactly the same as BOOST_PP_SEQ_REMOVE 537 </p> 538 </td> 539<td> 540 <p> 541 boost/vmd/seq/remove.hpp 542 </p> 543 </td> 544</tr> 545<tr> 546<td> 547 <p> 548 BOOST_VMD_SEQ_SIZE 549 </p> 550 </td> 551<td> 552 <p> 553 seq = a VMD seq 554 </p> 555 </td> 556<td> 557 <p> 558 The number of elements in the VMD seq 559 </p> 560 </td> 561<td> 562 <p> 563 Returns the number of elements in the VMD seq. If the seq is empty 564 returns 0, otherwise works exactly the same as BOOST_PP_SEQ_SIZE 565 </p> 566 </td> 567<td> 568 <p> 569 boost/vmd/seq/size.hpp 570 </p> 571 </td> 572</tr> 573<tr> 574<td> 575 <p> 576 BOOST_VMD_SEQ_TO_ARRAY 577 </p> 578 </td> 579<td> 580 <p> 581 seq = a VMD seq 582 </p> 583 </td> 584<td> 585 <p> 586 A Boost PP array 587 </p> 588 </td> 589<td> 590 <p> 591 Converts a VMD seq to a Boost PP array. If the seq is empty returns 592 an empty array whose form is '(0,())', otherwise works exactly 593 the same as BOOST_PP_SEQ_TO_ARRAY 594 </p> 595 </td> 596<td> 597 <p> 598 boost/vmd/seq/to_array.hpp 599 </p> 600 </td> 601</tr> 602<tr> 603<td> 604 <p> 605 BOOST_VMD_SEQ_TO_LIST 606 </p> 607 </td> 608<td> 609 <p> 610 seq = a VMD seq 611 </p> 612 </td> 613<td> 614 <p> 615 A Boost PP list 616 </p> 617 </td> 618<td> 619 <p> 620 Converts a VMD seq to a Boost PP list. If the seq is empty returns 621 an empty list whose form is 'BOOST_PP_NIL', otherwise works exactly 622 the same as BOOST_PP_SEQ_TO_LIST 623 </p> 624 </td> 625<td> 626 <p> 627 boost/vmd/seq/to_list.hpp 628 </p> 629 </td> 630</tr> 631<tr> 632<td> 633 <p> 634 BOOST_VMD_SEQ_TO_TUPLE 635 </p> 636 </td> 637<td> 638 <p> 639 seq = a VMD seq 640 </p> 641 </td> 642<td> 643 <p> 644 A VMD tuple 645 </p> 646 </td> 647<td> 648 <p> 649 Converts a VMD seq to a VMD tuple. If the seq is empty returns 650 an empty tuple, otherwise works exactly the same as BOOST_PP_SEQ_TO_TUPLE 651 </p> 652 </td> 653<td> 654 <p> 655 boost/vmd/seq/to_tuple.hpp 656 </p> 657 </td> 658</tr> 659</tbody> 660</table></div> 661</div> 662<br class="table-break"><p> 663 The difference between the seq macros and their equivalent ones in Boost 664 PP is that working with a VMD seq or returning a VMD seq is valid with the 665 seq macros but with the Boost PP equivalent macros working with an empty 666 seq causes UB and returning an empty seq can never occur. 667 </p> 668<p> 669 You can include the seq macros either using their individual header files, 670 the general 'boost/vmd/seq.hpp' header file for all seq macros, or the general 671 header file 'boost/vmd/vmd.hpp' for all macros. 672 </p> 673<h5> 674<a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata.h3"></a> 675 <span class="phrase"><a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata.tuple_macros"></a></span><a class="link" href="vmd_empty_ppdata.html#variadic_macro_data.vmd_useful.vmd_empty_ppdata.tuple_macros">Tuple 676 macros</a> 677 </h5> 678<p> 679 The tuple macros either work with a VMD tuple or return a VMD tuple. The 680 tuple macros are: 681 </p> 682<div class="table"> 683<a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata.vpp_tuple"></a><p class="title"><b>Table 1.5. Tuple macros</b></p> 684<div class="table-contents"><table class="table" summary="Tuple macros"> 685<colgroup> 686<col> 687<col> 688<col> 689<col> 690<col> 691</colgroup> 692<thead><tr> 693<th> 694 <p> 695 Macro 696 </p> 697 </th> 698<th> 699 <p> 700 Parameter 701 </p> 702 </th> 703<th> 704 <p> 705 Return 706 </p> 707 </th> 708<th> 709 <p> 710 Functionality 711 </p> 712 </th> 713<th> 714 <p> 715 Header 716 </p> 717 </th> 718</tr></thead> 719<tbody> 720<tr> 721<td> 722 <p> 723 BOOST_VMD_IS_VMD_TUPLE 724 </p> 725 </td> 726<td> 727 <p> 728 sequence = a VMD sequence 729 </p> 730 </td> 731<td> 732 <p> 733 1 if the VMD sequence is a VMD tuple, else 0 734 </p> 735 </td> 736<td> 737 <p> 738 Tests a sequence as a VMD tuple. If the sequence is empty returns 739 1, otherwise returns the same as BOOST_VMD_IS_TUPLE 740 </p> 741 </td> 742<td> 743 <p> 744 boost/vmd/tuple/is_vmd_tuple.hpp 745 </p> 746 </td> 747</tr> 748<tr> 749<td> 750 <p> 751 BOOST_VMD_TUPLE_POP_BACK 752 </p> 753 </td> 754<td> 755 <p> 756 tuple = a Boost PP tuple 757 </p> 758 </td> 759<td> 760 <p> 761 A VMD tuple 762 </p> 763 </td> 764<td> 765 <p> 766 Pops an element from the end of a tuple. If the tuple's size is 767 1 returns an empty tuple, otherwise works exactly the same as BOOST_PP_TUPLE_POP_BACK 768 </p> 769 </td> 770<td> 771 <p> 772 boost/vmd/tuple/pop_back.hpp 773 </p> 774 </td> 775</tr> 776<tr> 777<td> 778 <p> 779 BOOST_VMD_TUPLE_POP_FRONT 780 </p> 781 </td> 782<td> 783 <p> 784 tuple = a Boost PP tuple 785 </p> 786 </td> 787<td> 788 <p> 789 A VMD tuple 790 </p> 791 </td> 792<td> 793 <p> 794 Pops an element from the beginning of a tuple. If the tuple's size 795 is 1 returns an empty tuple, otherwise works exactly the same as 796 BOOST_PP_TUPLE_POP_FRONT 797 </p> 798 </td> 799<td> 800 <p> 801 boost/vmd/tuple/pop_front.hpp 802 </p> 803 </td> 804</tr> 805<tr> 806<td> 807 <p> 808 BOOST_VMD_TUPLE_PUSH_BACK 809 </p> 810 </td> 811<td> 812 <p> 813 tuple = a VMD tuple, elem = element to push onto the end of the 814 VMD tuple 815 </p> 816 </td> 817<td> 818 <p> 819 A Boost PP tuple 820 </p> 821 </td> 822<td> 823 <p> 824 Pushes an element onto the end of a VMD tuple. If the VMD tuple 825 is empty the returned tuple consists of that element, otherwise 826 works exactly the same as BOOST_PP_TUPLE_PUSH_BACK 827 </p> 828 </td> 829<td> 830 <p> 831 boost/vmd/tuple/push_back.hpp 832 </p> 833 </td> 834</tr> 835<tr> 836<td> 837 <p> 838 BOOST_VMD_TUPLE_PUSH_FRONT 839 </p> 840 </td> 841<td> 842 <p> 843 tuple = a VMD tuple, elem = element to push onto the beginning 844 of the VMD tuple 845 </p> 846 </td> 847<td> 848 <p> 849 A Boost PP tuple 850 </p> 851 </td> 852<td> 853 <p> 854 Pushes an element onto the beginning of a VMD tuple. If the VMD 855 tuple is empty the returned tuple consists of that element, otherwise 856 works exactly the same as BOOST_PP_TUPLE_PUSH_FRONT 857 </p> 858 </td> 859<td> 860 <p> 861 boost/vmd/tuple/push_front.hpp 862 </p> 863 </td> 864</tr> 865<tr> 866<td> 867 <p> 868 BOOST_VMD_TUPLE_REMOVE 869 </p> 870 </td> 871<td> 872 <p> 873 tuple = a Boost PP tuple, i = index of element to remove 874 </p> 875 </td> 876<td> 877 <p> 878 A VMD tuple 879 </p> 880 </td> 881<td> 882 <p> 883 Removes an element from a Boost PP tuple. If the tuple has a single 884 element and the index to be removed is 0 returns an empty tuple, 885 otherwise works exactly the same as BOOST_PP_TUPLE_REMOVE 886 </p> 887 </td> 888<td> 889 <p> 890 boost/vmd/tuple/remove.hpp 891 </p> 892 </td> 893</tr> 894<tr> 895<td> 896 <p> 897 BOOST_VMD_TUPLE_SIZE 898 </p> 899 </td> 900<td> 901 <p> 902 tuple = a VMD tuple 903 </p> 904 </td> 905<td> 906 <p> 907 The number of elements in the VMD tuple 908 </p> 909 </td> 910<td> 911 <p> 912 Returns the number of elements in the VMD tuple. If the tuple is 913 empty returns 0, otherwise works exactly the same as BOOST_PP_TUPLE_SIZE 914 </p> 915 </td> 916<td> 917 <p> 918 boost/vmd/tuple/size.hpp 919 </p> 920 </td> 921</tr> 922<tr> 923<td> 924 <p> 925 BOOST_VMD_TUPLE_TO_ARRAY 926 </p> 927 </td> 928<td> 929 <p> 930 tuple = a VMD tuple 931 </p> 932 </td> 933<td> 934 <p> 935 A Boost PP array 936 </p> 937 </td> 938<td> 939 <p> 940 Converts a VMD tuple to a Boost PP array. If the tuple is empty 941 returns an empty array whose form is '(0,())', otherwise works 942 exactly the same as BOOST_PP_TUPLE_TO_ARRAY 943 </p> 944 </td> 945<td> 946 <p> 947 boost/vmd/tuple/to_array.hpp 948 </p> 949 </td> 950</tr> 951<tr> 952<td> 953 <p> 954 BOOST_VMD_TUPLE_TO_LIST 955 </p> 956 </td> 957<td> 958 <p> 959 tuple = a VMD tuple 960 </p> 961 </td> 962<td> 963 <p> 964 A Boost PP list 965 </p> 966 </td> 967<td> 968 <p> 969 Converts a VMD tuple to a Boost PP list. If the tuple is empty 970 returns an empty list whose form is 'BOOST_PP_NIL', otherwise works 971 exactly the same as BOOST_PP_TUPLE_TO_LIST 972 </p> 973 </td> 974<td> 975 <p> 976 boost/vmd/tuple/to_list.hpp 977 </p> 978 </td> 979</tr> 980<tr> 981<td> 982 <p> 983 BOOST_VMD_TUPLE_TO_SEQ 984 </p> 985 </td> 986<td> 987 <p> 988 tuple = a VMD tuple 989 </p> 990 </td> 991<td> 992 <p> 993 A VMD seq 994 </p> 995 </td> 996<td> 997 <p> 998 Converts a VMD tuple to a VMD seq. If the tuple is empty returns 999 an empty seq, otherwise works exactly the same as BOOST_PP_TUPLE_TO_SEQ 1000 </p> 1001 </td> 1002<td> 1003 <p> 1004 boost/vmd/tuple/to_seq.hpp 1005 </p> 1006 </td> 1007</tr> 1008</tbody> 1009</table></div> 1010</div> 1011<br class="table-break"><p> 1012 The difference between the tuple macros and their equivalent ones in Boost 1013 PP is that working with a VMD tuple or returning a VMD tuple is valid with 1014 the tuple macros but with the Boost PP equivalent macros working with an 1015 empty tuple causes UB and returning an empty tuple can never occur. 1016 </p> 1017<p> 1018 You can include the tuple macros either using their individual header files, 1019 the general 'boost/vmd/tuple.hpp' header file for all tuple macros, or the 1020 general header file 'boost/vmd/vmd.hpp' for all macros. 1021 </p> 1022<h5> 1023<a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata.h4"></a> 1024 <span class="phrase"><a name="variadic_macro_data.vmd_useful.vmd_empty_ppdata.seq_and_tuple_functionality"></a></span><a class="link" href="vmd_empty_ppdata.html#variadic_macro_data.vmd_useful.vmd_empty_ppdata.seq_and_tuple_functionality">Seq 1025 and tuple functionality</a> 1026 </h5> 1027<p> 1028 The set of macros for seq and tuple functionality which work with VMD seqs 1029 and VMD tuples are largely only a subset of the seq and tuple functionality 1030 in Boost PP. This reflects the fact that a number of macros in Boost PP for 1031 working with a seq or tuple make no sense when extended to work with a possible 1032 empty seq or empty tuple. For instance BOOST_PP_SEQ_FIRST_N could not mean 1033 anything when passed an empty seq and BOOST_PP_TUPLE_REM_CTOR could not mean 1034 anything when passed an empty tuple. Likewise for other Boost PP seq and 1035 tuple macros which do not have a VMD equivalent. 1036 </p> 1037<p> 1038 The set of functionality in VMD for working with a possibly empty seq or 1039 empty tuple makes it possible to add or remove elements in a seq or tuple 1040 which could start out or end up empty, take the seq or tuple size even when 1041 the seq or tuple is empty, convert between arrays, lists, seqs, or tuples 1042 which could start out or end up empty, and test for a VMD seq or a VMD tuple. 1043 This functionality should allow macro programmers the ability to work with 1044 empty seqs and tuples while still using other Boost PP seq and tuple functuionality 1045 to work with non-empty seqs and tuples. The easiest way to do this is to 1046 use the VMD seq and VMD tuple equivalent functions when choosing between 1047 VMD and Boost PP, and use the Boost PP seq and tuple functionality otherwise. 1048 Just remember that Boost PP seq and tuple functionality can never work with 1049 empty seqs or empty tuples. 1050 </p> 1051</div> 1052<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 1053<td align="left"></td> 1054<td align="right"><div class="copyright-footer">Copyright © 2010-2017 Tropic Software 1055 East Inc</div></td> 1056</tr></table> 1057<hr> 1058<div class="spirit-nav"> 1059<a accesskey="p" href="vmd_identity.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../vmd_useful.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../vmd_internal_macros.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 1060</div> 1061</body> 1062</html> 1063