File tree Expand file tree Collapse file tree 1 file changed +1
-18
lines changed Expand file tree Collapse file tree 1 file changed +1
-18
lines changed Original file line number Diff line number Diff line change @@ -9622,24 +9622,7 @@ Exception: Do not produce such a warning on a local `Unique_pointer` to an unbou
96229622
96239623##### Exception
96249624
9625- It is OK to create a local `const unique_ptr<T[]>` to a heap-allocated buffer, as this is a valid way to represent a scoped dynamic array.
9626-
9627- ##### Example
9628-
9629- A valid use case for a local `const unique_ptr<T[]>` variable:
9630-
9631- int get_median_value(const std::list<int>& integers)
9632- {
9633- const auto size = integers.size();
9634-
9635- // OK: declaring a local unique_ptr<T[]>.
9636- const auto local_buffer = std::make_unique_for_overwrite<int[]>(size);
9637-
9638- std::copy_n(begin(integers), size, local_buffer.get());
9639- std::nth_element(local_buffer.get(), local_buffer.get() + size/2, local_buffer.get() + size);
9640-
9641- return local_buffer[size/2];
9642- }
9625+ If your stack space is limited, it is OK to create a local `const unique_ptr<BigObject>` to store the object on the heap instead of the stack.
96439626
96449627### <a name="Rr-global"></a>R.6: Avoid non-`const` global variables
96459628
You can’t perform that action at this time.
0 commit comments