Skip to content

Commit

Permalink
[libc++] Removes cpp17_output_iterator's default constructor.
Browse files Browse the repository at this point in the history
This has been suggested in D117950.

Reviewed By: ldionne, #libc, philnik

Differential Revision: https://reviews.llvm.org/D118971
  • Loading branch information
mordante committed Feb 8, 2022
1 parent 3df88ec commit a0071b9
Show file tree
Hide file tree
Showing 7 changed files with 4,807 additions and 4,830 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ void test() {
const int *oa2 = Expectations::oa2;
((void)oa2); // Prevent unused warning
std::minstd_rand g;
SampleIterator end;
end = std::sample(PopulationIterator(ia),
PopulationIterator(ia + is),
SampleIterator(oa), os, g);
SampleIterator end = std::sample(PopulationIterator(ia),
PopulationIterator(ia + is),
SampleIterator(oa), os, g);
assert(static_cast<std::size_t>(end.base() - oa) == std::min(os, is));
// sample() is deterministic but non-reproducible;
// its results can vary between implementations.
Expand Down Expand Up @@ -123,10 +122,9 @@ void test_small_population() {
SampleItem oa[os];
const SampleItem oa1[] = {1, 2, 3, 4, 5};
std::minstd_rand g;
SampleIterator end;
end = std::sample(PopulationIterator(ia),
PopulationIterator(ia + is),
SampleIterator(oa), os, g);
SampleIterator end = std::sample(PopulationIterator(ia),
PopulationIterator(ia + is),
SampleIterator(oa), os, g);
assert(static_cast<std::size_t>(end.base() - oa) == std::min(os, is));
typedef typename std::iterator_traits<PopulationIterator>::iterator_category PopulationCategory;
if (std::is_base_of<std::forward_iterator_tag, PopulationCategory>::value) {
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class my_facet
int main(int, char**)
{
char str[200];
cpp17_output_iterator<char*> iter;
tm t;
t.tm_sec = 6;
t.tm_min = 3;
Expand All @@ -63,15 +62,16 @@ int main(int, char**)
{
const my_facet f(LOCALE_en_US_UTF_8, 1);
std::string pat("Today is %A which is abbreviated %a.");
iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', &t, pat.data(), pat.data() + pat.size());
cpp17_output_iterator<char*> iter =
f.put(cpp17_output_iterator<char*>(str), ios, '*', &t, pat.data(), pat.data() + pat.size());
std::string ex(str, iter.base());
assert(ex == "Today is Saturday which is abbreviated Sat.");
}
{
const my_facet f(LOCALE_fr_FR_UTF_8, 1);
std::string pat("Today is %A which is abbreviated '%a'.");
iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', &t,
pat.data(), pat.data() + pat.size());
cpp17_output_iterator<char*> iter =
f.put(cpp17_output_iterator<char*>(str), ios, '*', &t, pat.data(), pat.data() + pat.size());
std::string ex(str, iter.base());
assert((ex == "Today is Samedi which is abbreviated 'Sam'.")||
(ex == "Today is samedi which is abbreviated 'sam'." )||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ int main(int, char**)
{
const my_facet f(1);
char str[200];
cpp17_output_iterator<char*> iter;
tm t;
t.tm_sec = 6;
t.tm_min = 3;
Expand All @@ -47,13 +46,15 @@ int main(int, char**)
std::ios ios(0);
{
std::string pat("Today is %A which is abbreviated %a.");
iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', &t, pat.data(), pat.data() + pat.size());
cpp17_output_iterator<char*> iter =
f.put(cpp17_output_iterator<char*>(str), ios, '*', &t, pat.data(), pat.data() + pat.size());
std::string ex(str, iter.base());
assert(ex == "Today is Saturday which is abbreviated Sat.");
}
{
std::string pat("The number of the month is %Om.");
iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', &t, pat.data(), pat.data() + pat.size());
cpp17_output_iterator<char*> iter =
f.put(cpp17_output_iterator<char*>(str), ios, '*', &t, pat.data(), pat.data() + pat.size());
std::string ex(str, iter.base());
assert(ex == "The number of the month is 05.");
}
Expand Down
Loading

0 comments on commit a0071b9

Please sign in to comment.