Skip to content
Snippets Groups Projects
Commit 174f9257 authored by Antony Polukhin's avatar Antony Polukhin Committed by Jonathan Wakely
Browse files

libstdc++: Optimize std::seed_seq construction


When std::seed_seq is constructed from random access iterators we can
detect the internal vector size in O(1). Reserving memory for elements
in such cases may avoid multiple memory allocations.

Signed-off-by: default avatarJonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/random.tcc (seed_seq::seed_seq): Reserve capacity
	if distance is O(1).
	* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error
	line number.

Co-authored-by: default avatarJonathan Wakely <jwakely@redhat.com>
parent 897a15f3
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment