functions_symmetric_difference.qbk 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. [/
  2. Copyright (c) 2008-2010 Joachim Faulhaber
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt)
  6. ]
  7. [/ //= Symmetric Difference ===================================================]
  8. [section Symmetric Difference]
  9. [section Synopsis][/ Symmetric difference]
  10. [table
  11. [[Symmetric difference] [__ch_itv_sets__][__ch_itv_maps__][__ch_ele_sets__][__ch_ele_maps__] ]
  12. [[`T& T::flip(const P&)`] [__ei] [__bp] [ ] [__b] ]
  13. [[`T& flip(T&, const P&)`] [__ei] [__bp] [__e] [__b] ]
  14. [[`T& operator ^=(T&, const P&)`] [__eiS] [__bpM] [__es] [__bm] ]
  15. [[`T operator ^ (T, const P&)`\n
  16. `T operator ^ (const P&, T)`] [__eiS] [__bpM] [__es] [__bm] ]
  17. ]
  18. Functions and operators that implement ['*symmetric difference*] on *icl* objects
  19. are given in the table above.
  20. [table
  21. [[] [Description of symmetric difference]]
  22. [[`Sets`][`operator ^` implements ['*set symmetric difference*]]]
  23. [[`Maps`][`operator ^` implements a ['*map symmetric difference*]
  24. function similar to /set symmetric difference/.
  25. All pairs that are common to both arguments are removed. All others unified.
  26. ]]
  27. ]
  28. [endsect][/ Synopsis Symmetric difference]
  29. [section Functions][/ Symmetric difference]
  30. /Symmetric difference/ is implemented on interval containers
  31. by the function `T& flip(T&, const P& operand)`.
  32. ``
  33. flip(y,x)
  34. ``
  35. deletes every element of `y`,
  36. if it is contained in `x`. Elements of
  37. `x` not contained in `y` are added.
  38. For icl containers flip is also availabel as memeber function
  39. `T& T::flip(const P& operand)`.
  40. [/ paratract, surtract, symetract, topple, symmetric_subtract]
  41. The admissible combinations of types for member function
  42. `T& T::flip(const P&)` can be summarized in the
  43. ['*overload table*] below:
  44. ``
  45. /* overload table for */ T\P| e i b p
  46. T& T::flip(const P&) ---+--------
  47. T& flip(T&, const P&) s | s
  48. m | m
  49. S | S S
  50. M | M M
  51. ``
  52. The next table contains complexity characteristics for functions `flip`.
  53. [table Time Complexity for member functions flip on icl containers
  54. [[`T& T::flip(const P&)`\n
  55. `T& flip(T&, const P&)`] [__ch_dom_t__][__ch_itv_t__][__ch_dom_mp_t__][__ch_itv_mp_t__]]
  56. [[__icl_set__] [__Olgn__] [] [] [] ]
  57. [[__icl_map__] [] [] [__Olgn__][] ]
  58. [[__itv_set__\n__sep_itv_set__][__Olgn__] [__On__] [] [] ]
  59. [[__spl_itv_set__] [__Olgn__] [__On__] [] [] ]
  60. [[__itv_map__\n__spl_itv_map__][] [] [__Olgn__][__On__] ]
  61. ]
  62. [endsect][/ Member functions Symmetric difference]
  63. [section Inplace operators][/ Symmetric Difference]
  64. The overload tables below are giving admissible
  65. type combinations for `operator ^=`
  66. that implements ['*symmetric difference*].
  67. ``
  68. // overload tables for element containers: interval containers:
  69. T& operator ^= (T&, const P&) ^= | e b s m ^= | e i b p S M
  70. ---+-------- ---+------------
  71. s | s s S | S S S
  72. m | m m M | M M M
  73. ``
  74. Complexity characteristics for inplace operators
  75. that implement ['*symmetric difference*]
  76. are given by the next tables where
  77. ``
  78. n = iterative_size(y);
  79. m = iterative_size(x); //if P is a container
  80. ``
  81. [table Time Complexity for inplace symmetric difference on element containers
  82. [[`T& operator &= (T& y, const P& x)`][__ch_dom_t__][__ch_dom_mp_t__][__ch_icl_set__][__ch_icl_map__]]
  83. [[__icl_set__] [__Olgn__] [] [__Omlgn__] [] ]
  84. [[__icl_map__] [__Olgn__] [__Olgn__] [__Omlgn__] [__Omlgn__] ]
  85. ]
  86. [table Time Complexity for inplace symmetric difference on interval containers
  87. [[`T& operator &= (T&, const P&)`][__ch_dom_t__][__ch_itv_t__][__ch_dom_mp_t__][__ch_itv_mp_t__][__ch_itv_sets__][__ch_itv_maps__]]
  88. [[interval_sets] [__Olgn__] [__On__] [] [] [__Omlgnpm__] [] ]
  89. [[interval_maps] [__Olgn__] [__On__] [__Olgn__] [__On__] [__Omlgnpm__] [__Omlgnpm__] ]
  90. ]
  91. [endsect][/ Inplace operators Symmetric Difference]
  92. [section Infix operators][/ Symmetric Difference]
  93. For the infix version of symmetric difference the
  94. following overloads are available:
  95. ``
  96. // overload tables for element containers: interval containers:
  97. T operator ^ (T, const P&) ^ | e b s m ^ | e i b p S1 S2 S3 M1 M3
  98. T operator ^ (const P&, T) ---+-------- ---+---------------------------
  99. e | s e | S1 S2 S3
  100. b | m i | S1 S2 S3
  101. s | s s b | M1 M3
  102. m | m m p | M1 M3
  103. S1 | S1 S1 S1 S2 S3
  104. S2 | S2 S2 S2 S2 S3
  105. S3 | S3 S3 S3 S3 S3
  106. M1 | M1 M1 M1 M3
  107. M3 | M3 M3 M3 M3
  108. ``
  109. To resolve ambiguities among interval containers
  110. the ['*finer*] container type is chosen as result type.
  111. [endsect][/ Infix operators Symmetric Difference]
  112. ['*See also . . .*]
  113. [table
  114. []
  115. [[[link boost_icl.function_reference.intersection ['*Intersection*]] ]]
  116. [[[link boost_icl.function_reference.subtraction ['*Subtraction*]] ]]
  117. [[[link boost_icl.function_reference.addition ['*Addition*]] ]]
  118. ]
  119. ['*Back to section . . .*]
  120. [table
  121. []
  122. [[[link function_synopsis_table ['*Function Synopsis*]] ]]
  123. [[[link boost_icl.interface ['*Interface*]] ]]
  124. ]
  125. [endsect][/ Symmetric Difference]