functions_insertion.qbk 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. [/ //= Insertion ===================================================================]
  8. [section Insertion]
  9. [section Synopsis][/ Insertion]
  10. [table
  11. [[['*Insertion*]][__ch_itv_sets__][__ch_itv_maps__][__ch_ele_sets__][__ch_ele_maps__] ]
  12. [[`V T::insert(const P&)`] [__ei] [__bp] [__e] [__b] ]
  13. [[`V insert(T&, const P&)`] [__ei] [__bp] [__e] [__b] ]
  14. [[`J T::insert(J pos, const P&)`] [__i] [__p] [__e] [__b] ]
  15. [[`J insert(T&, J pos, const P&)`] [__i] [__p] [__e] [__b] ]
  16. [[`T& insert(T&, const P&)`] [__eiS] [__bpM] [__es] [__bm] ]
  17. [[`T& T::set(const P&)`] [ ] [__bp] [ ] [1] ]
  18. [[`T& set_at(T&, const P&)`] [ ] [__bp] [ ] [1] ]
  19. ]
  20. [h5 Insertion]
  21. The effects of ['*insertion*] implemented by `insert` and ['*addition*]
  22. implemented by `add` and `operator +=` are identical for all Set-types of
  23. the *icl*.
  24. For Map-types, `insert` provides the *stl* semantics of insertion in
  25. contrast to `add` and `operator +=`, that implement a generalized addition,
  26. that performs aggregations if key values collide or key intervals overlap.
  27. `insert` on Maps does not alter a maps content at the points, where
  28. the keys of the object to inserted overlap or collide with keys that
  29. are already in the map.
  30. [h5 Setting values]
  31. Overwriting values using `operator[]` like in
  32. ``
  33. my_map[key] = new_value;
  34. ``
  35. is not provided for __itv_maps__ because an `operator[]` is not
  36. implemented for them. As a substitute a function
  37. `T& T::set(const P&)` can be used to achieve the same effect:
  38. ``
  39. my_map.set(make_pair(overwrite_this, new_value));
  40. ``
  41. [endsect][/ Synopsis Insertion]
  42. [section Insertion]
  43. ``
  44. // overload table for functions T\P| e i b p
  45. V T::insert(const P&) ---+--------
  46. V insert(T&, const P&) s | s
  47. m | m
  48. S | S
  49. M | M
  50. ``
  51. [table Time Complexity for member function insert on icl containers
  52. [[`T& T::insert(const P&)`] [__ch_dom_t__][__ch_itv_t__][__ch_dom_mp_t__][__ch_itv_mp_t__]]
  53. [[__icl_set__] [__Olgn__] [] [] [] ]
  54. [[__icl_map__] [] [] [__Olgn__][] ]
  55. [[__itv_set__\n__sep_itv_set__][__Olgn__] [__a_Olgn__][] [] ]
  56. [[__spl_itv_set__] [__Olgn__] [__On__] [] [] ]
  57. [[__itv_map__\n__spl_itv_map__][] [] [__Olgn__][__On__] ]
  58. ]
  59. ``
  60. // overload tables for function element containers: interval containers:
  61. T& insert(T&, const P&) T\P| e b s m T\P| e i b p S M
  62. ---+-------- ---+------------
  63. s | s s S | S S S
  64. m | m m M | M M M
  65. ``
  66. [table Time Complexity for inplace insertion on element containers
  67. [[`T& insert(T& y, const P& x)`][__ch_dom_t__][__ch_dom_mp_t__][__ch_itv_sets__][__ch_itv_maps__]]
  68. [[__icl_set__] [__Olgn__] [] [__Om__] [] ]
  69. [[__icl_map__] [] [__Olgn__] [] [__Om__] ]
  70. ]
  71. Time complexity characteristics of inplace insertion for interval containers
  72. is given by this table.
  73. [table Time Complexity for inplace insertion on interval containers
  74. [[`T& insert(T& y, const P& x)`][][__ch_dom_t__][__ch_itv_t__][__ch_dom_mp_t__][__ch_itv_mp_t__][__ch_itv_sets__][__ch_itv_maps__]]
  75. [[interval_sets][__itv_set__\n__sep_itv_set__][__Olgn__] [__a_Olgn__][] [] [__Omlgnpm__] [] ]
  76. [[] [__spl_itv_set__] [__Olgn__] [__On__] [] [] [__Omlgnpm__] [] ]
  77. [[interval_maps][] [] [] [__Olgn__][__On__] [] [__Omlgnpm__] ]
  78. ]
  79. [h4 Hinted insertion]
  80. Function `J T::insert(J prior, const P& addend)` allows
  81. for an insertion in ['*constant time*], if `addend` can be inserted
  82. right after iterator `prior` without collision. If this is not possible
  83. the complexity characteristics are as stated for the non hinted insertion
  84. above. Hinted insertion is available for these combinations of types:
  85. ``
  86. // overload table for insertion with hint T\P| e i b p
  87. J T::insert(J pos, const P&) ---+--------
  88. J insert(T&, J pos, const P&) s | s
  89. m | m
  90. S | S
  91. M | M
  92. ``
  93. [endsect][/ Insertion]
  94. [section Setting values]
  95. ``
  96. // overload table for member function T\P| b p
  97. T& T::set(const P&) ---+----
  98. T& set_at(T&, const P&) m | m
  99. M | M
  100. ``
  101. [table Time Complexity for member function `set`
  102. [[`T& set(T&, const P&)`] [domain_mapping_type] [interval_mapping_type] ]
  103. [[icl::map] [__Olgn__] [ ] ]
  104. [[interval_maps] [] [__a_Olgn__] ]
  105. ]
  106. [endsect][/ Set]
  107. ['*See also . . .*]
  108. [table
  109. []
  110. [[[link boost_icl.function_reference.addition ['*Erasure*]] ]]
  111. [[[link boost_icl.function_reference.addition ['*Addition*]] ]]
  112. ]
  113. ['*Back to section . . .*]
  114. [table
  115. []
  116. [[[link function_synopsis_table ['*Function Synopsis*]]]]
  117. [[[link boost_icl.interface ['*Interface*]] ]]
  118. ]
  119. [endsect][/ Insertion]