Fix random_device to work with COW strings again
authorJonathan Wakely <jwakely@redhat.com>
Fri, 31 May 2019 10:34:53 +0000 (11:34 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 31 May 2019 10:34:53 +0000 (11:34 +0100)
commitaeedf0770557f01e46b95c220496e1b6d8b96149
tree371dab6b8c5b2d0ce445476143bb14ac12e4d594
parentdecc53df4e4e50f1f202e1cb01acbceb8320f841
Fix random_device to work with COW strings again

Instead of duplicating the initialization functions that take string,
add a new member taking a raw pointer that can be used to convert the
constructor token from the old string to the new.

Also fix "mt19337" typos in a testcase.

* include/bits/random.h (random_device::_M_init(const char*, size_t)):
Add new private member function.
* src/c++11/cow-string-inst.cc (random_device::_M_init(const string&))
(random_device::_M_init_pretr1(const string&)): Call new private
member with string data.
* src/c++11/random.cc (random_device::_M_init(const char*, size_t)):
Define.
* testsuite/26_numerics/random/random_device/cons/default-cow.cc: New
test using COW strings.
* testsuite/26_numerics/random/random_device/cons/default.cc: Generate
a value from the device.
* testsuite/26_numerics/random/random_device/cons/token.cc: Likewise.
Fix typo in token string.

From-SVN: r271805
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/random.h
libstdc++-v3/src/c++11/cow-string-inst.cc
libstdc++-v3/src/c++11/random.cc
libstdc++-v3/testsuite/26_numerics/random/random_device/cons/default-cow.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/random_device/cons/default.cc
libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc