[libcxx] [test] Strip trailing whitespace. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346826 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Stephan T. Lavavej
2018-11-14 03:06:06 +00:00
parent ad46a18a84
commit 439de45011
164 changed files with 538 additions and 539 deletions

View File

@@ -32,7 +32,7 @@ struct Throws {
static bool sThrows;
};
bool Throws::sThrows = false;
#endif

View File

@@ -34,7 +34,7 @@ struct Throws {
static bool sThrows;
};
bool Throws::sThrows = false;
#endif

View File

@@ -7,13 +7,13 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// template<class T, ptrdiff_t X, class U, ptrdiff_t Y>
// constexpr bool operator==(span<T, X> l, span<U, Y> r);
//
//
//
// Effects: Equivalent to: return equal(l.begin(), l.end(), r.begin(), r.end());
//
@@ -30,7 +30,7 @@ constexpr int iArr1[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
int iArr2[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
constexpr float fArr1[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
float fArr2[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
int main () {
@@ -50,15 +50,15 @@ int main () {
static_assert( (csp0s == csp0s), "");
static_assert( (csp0s == csp0d), "");
static_assert( (csp0d == csp0s), "");
static_assert(!(csp0d == csp1d), "");
static_assert(!(csp0s == csp1s), "");
static_assert(!(csp0s == csp1d), "");
static_assert(!(csp0d == csp1s), "");
static_assert( (csp1d == csp1s), "");
static_assert( (csp1s == csp1d), "");
static_assert( (csp2d == csp3d), "");
static_assert( (csp2s == csp3s), "");
static_assert( (csp2d == csp3s), "");
@@ -95,15 +95,15 @@ int main () {
assert( (sp0s == sp0s));
assert( (sp0s == sp0d));
assert( (sp0d == sp0s));
assert(!(sp0d == sp1d));
assert(!(sp0s == sp1s));
assert(!(sp0s == sp1d));
assert(!(sp0d == sp1s));
assert( (sp1d == sp1s));
assert( (sp1s == sp1d));
assert( (sp2d == sp3d));
assert( (sp2s == sp3s));
assert( (sp2d == sp3s));
@@ -129,15 +129,15 @@ int main () {
assert( (csp0s == sp0s));
assert( (csp0s == sp0d));
assert( (csp0d == sp0s));
assert(!(csp0d == sp1d));
assert(!(csp0s == sp1s));
assert(!(csp0s == sp1d));
assert(!(csp0d == sp1s));
assert( (csp1d == sp1s));
assert( (csp1s == sp1d));
assert( (csp2d == sp3d));
assert( (csp2s == sp3s));
assert( (csp2d == sp3s));
@@ -152,7 +152,7 @@ int main () {
assert(!(csp2s == sp4s));
assert(!(csp2d == sp4s));
assert(!(csp2s == sp4d));
assert(!(csp4d == sp2d));
assert(!(csp4s == sp2s));
assert(!(csp4d == sp2s));
@@ -165,4 +165,4 @@ int main () {
assert(std::span<int>{iArr2} == std::span<float>{fArr2});
static_assert(!(std::span<const int>{iArr1, 9} == std::span<const float>{fArr1, 8}), "");
}
}

View File

@@ -7,13 +7,13 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// template<class T, ptrdiff_t X, class U, ptrdiff_t Y>
// constexpr bool operator>=(span<T, X> l, span<U, Y> r);
//
//
//
// Effects: Equivalent to: return !(l < r);
//
@@ -30,7 +30,7 @@ constexpr int iArr1[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
int iArr2[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
constexpr float fArr1[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
float fArr2[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
int main () {
@@ -50,15 +50,15 @@ int main () {
static_assert( (csp0s >= csp0s), "");
static_assert( (csp0s >= csp0d), "");
static_assert( (csp0d >= csp0s), "");
static_assert(!(csp0d >= csp1d), "");
static_assert(!(csp0s >= csp1s), "");
static_assert(!(csp0s >= csp1d), "");
static_assert(!(csp0d >= csp1s), "");
static_assert( (csp1d >= csp1s), "");
static_assert( (csp1s >= csp1d), "");
static_assert( (csp2d >= csp3d), "");
static_assert( (csp2s >= csp3s), "");
static_assert( (csp2d >= csp3s), "");
@@ -90,15 +90,15 @@ int main () {
assert( (sp0s >= sp0s));
assert( (sp0s >= sp0d));
assert( (sp0d >= sp0s));
assert(!(sp0d >= sp1d));
assert(!(sp0s >= sp1s));
assert(!(sp0s >= sp1d));
assert(!(sp0d >= sp1s));
assert( (sp1d >= sp1s));
assert( (sp1s >= sp1d));
assert( (sp2d >= sp3d));
assert( (sp2s >= sp3s));
assert( (sp2d >= sp3s));
@@ -119,15 +119,15 @@ int main () {
assert( (csp0s >= sp0s));
assert( (csp0s >= sp0d));
assert( (csp0d >= sp0s));
assert(!(csp0d >= sp1d));
assert(!(csp0s >= sp1s));
assert(!(csp0s >= sp1d));
assert(!(csp0d >= sp1s));
assert( (csp1d >= sp1s));
assert( (csp1s >= sp1d));
assert( (csp2d >= sp3d));
assert( (csp2s >= sp3s));
assert( (csp2d >= sp3s));
@@ -137,7 +137,7 @@ int main () {
assert(!(csp2s >= sp4s));
assert(!(csp2d >= sp4s));
assert(!(csp2s >= sp4d));
assert( (csp4d > sp2d));
assert( (csp4s > sp2s));
assert( (csp4d > sp2s));

View File

@@ -7,13 +7,13 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// template<class T, ptrdiff_t X, class U, ptrdiff_t Y>
// constexpr bool operator>(span<T, X> l, span<U, Y> r);
//
//
//
// Effects: Equivalent to: return (r < l);
//
@@ -30,7 +30,7 @@ constexpr int iArr1[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
int iArr2[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
constexpr float fArr1[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
float fArr2[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
int main () {
@@ -50,15 +50,15 @@ int main () {
static_assert(!(csp0s > csp0s), "");
static_assert(!(csp0s > csp0d), "");
static_assert(!(csp0d > csp0s), "");
static_assert(!(csp0d > csp1d), "");
static_assert(!(csp0s > csp1s), "");
static_assert(!(csp0s > csp1d), "");
static_assert(!(csp0d > csp1s), "");
static_assert(!(csp1d > csp1s), "");
static_assert(!(csp1s > csp1d), "");
static_assert(!(csp2d > csp3d), "");
static_assert(!(csp2s > csp3s), "");
static_assert(!(csp2d > csp3s), "");
@@ -90,15 +90,15 @@ int main () {
assert(!(sp0s > sp0s));
assert(!(sp0s > sp0d));
assert(!(sp0d > sp0s));
assert(!(sp0d > sp1d));
assert(!(sp0s > sp1s));
assert(!(sp0s > sp1d));
assert(!(sp0d > sp1s));
assert(!(sp1d > sp1s));
assert(!(sp1s > sp1d));
assert(!(sp2d > sp3d));
assert(!(sp2s > sp3s));
assert(!(sp2d > sp3s));
@@ -119,15 +119,15 @@ int main () {
assert(!(csp0s > sp0s));
assert(!(csp0s > sp0d));
assert(!(csp0d > sp0s));
assert(!(csp0d > sp1d));
assert(!(csp0s > sp1s));
assert(!(csp0s > sp1d));
assert(!(csp0d > sp1s));
assert(!(csp1d > sp1s));
assert(!(csp1s > sp1d));
assert(!(csp2d > sp3d));
assert(!(csp2s > sp3s));
assert(!(csp2d > sp3s));
@@ -137,7 +137,7 @@ int main () {
assert(!(csp2s > sp4s));
assert(!(csp2d > sp4s));
assert(!(csp2s > sp4d));
assert( (csp4d > sp2d));
assert( (csp4s > sp2s));
assert( (csp4d > sp2s));
@@ -151,4 +151,4 @@ int main () {
assert(!(std::span<int>{iArr2} > std::span<float>{fArr2}));
static_assert( (std::span<const int>{iArr1, 9} > std::span<const float>{fArr1, 8}), "");
}
}

View File

@@ -7,13 +7,13 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// template<class T, ptrdiff_t X, class U, ptrdiff_t Y>
// constexpr bool operator<=(span<T, X> l, span<U, Y> r);
//
//
//
// Effects: Equivalent to: return !(r < l);
//
@@ -30,7 +30,7 @@ constexpr int iArr1[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
int iArr2[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
constexpr float fArr1[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
float fArr2[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
int main () {
@@ -50,15 +50,15 @@ int main () {
static_assert( (csp0s <= csp0s), "");
static_assert( (csp0s <= csp0d), "");
static_assert( (csp0d <= csp0s), "");
static_assert( (csp0d <= csp1d), "");
static_assert( (csp0s <= csp1s), "");
static_assert( (csp0s <= csp1d), "");
static_assert( (csp0d <= csp1s), "");
static_assert( (csp1d <= csp1s), "");
static_assert( (csp1s <= csp1d), "");
static_assert( (csp2d <= csp3d), "");
static_assert( (csp2s <= csp3s), "");
static_assert( (csp2d <= csp3s), "");
@@ -90,15 +90,15 @@ int main () {
assert( (sp0s <= sp0s));
assert( (sp0s <= sp0d));
assert( (sp0d <= sp0s));
assert( (sp0d <= sp1d));
assert( (sp0s <= sp1s));
assert( (sp0s <= sp1d));
assert( (sp0d <= sp1s));
assert( (sp1d <= sp1s));
assert( (sp1s <= sp1d));
assert( (sp2d <= sp3d));
assert( (sp2s <= sp3s));
assert( (sp2d <= sp3s));
@@ -119,15 +119,15 @@ int main () {
assert( (csp0s <= sp0s));
assert( (csp0s <= sp0d));
assert( (csp0d <= sp0s));
assert( (csp0d <= sp1d));
assert( (csp0s <= sp1s));
assert( (csp0s <= sp1d));
assert( (csp0d <= sp1s));
assert( (csp1d <= sp1s));
assert( (csp1s <= sp1d));
assert( (csp2d <= sp3d));
assert( (csp2s <= sp3s));
assert( (csp2d <= sp3s));
@@ -137,7 +137,7 @@ int main () {
assert( (csp2s <= sp4s));
assert( (csp2d <= sp4s));
assert( (csp2s <= sp4d));
assert(!(csp4d <= sp2d));
assert(!(csp4s <= sp2s));
assert(!(csp4d <= sp2s));
@@ -148,6 +148,6 @@ int main () {
static_assert(std::span<const int>{iArr1, 8} <= std::span<const float>{fArr1, 9}, "");
assert( (std::span<float>{fArr2} <= std::span<int>{iArr2}));
assert( (std::span<int>{iArr2} <= std::span<float>{fArr2}));
static_assert(!(std::span<const int>{iArr1, 9} <= std::span<const float>{fArr1, 8}), "");
}
}

View File

@@ -7,13 +7,13 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// template<class T, ptrdiff_t X, class U, ptrdiff_t Y>
// constexpr bool operator<(span<T, X> l, span<U, Y> r);
//
//
//
// Effects: Equivalent to:
// return lexicographical_compare(l.begin(), l.end(), r.begin(), r.end());
@@ -31,7 +31,7 @@ constexpr int iArr1[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
int iArr2[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
constexpr float fArr1[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
float fArr2[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
int main () {
@@ -51,15 +51,15 @@ int main () {
static_assert(!(csp0s < csp0s), "");
static_assert(!(csp0s < csp0d), "");
static_assert(!(csp0d < csp0s), "");
static_assert( (csp0d < csp1d), "");
static_assert( (csp0s < csp1s), "");
static_assert( (csp0s < csp1d), "");
static_assert( (csp0d < csp1s), "");
static_assert(!(csp1d < csp1s), "");
static_assert(!(csp1s < csp1d), "");
static_assert(!(csp2d < csp3d), "");
static_assert(!(csp2s < csp3s), "");
static_assert(!(csp2d < csp3s), "");
@@ -91,15 +91,15 @@ int main () {
assert(!(sp0s < sp0s));
assert(!(sp0s < sp0d));
assert(!(sp0d < sp0s));
assert( (sp0d < sp1d));
assert( (sp0s < sp1s));
assert( (sp0s < sp1d));
assert( (sp0d < sp1s));
assert(!(sp1d < sp1s));
assert(!(sp1s < sp1d));
assert(!(sp2d < sp3d));
assert(!(sp2s < sp3s));
assert(!(sp2d < sp3s));
@@ -120,15 +120,15 @@ int main () {
assert(!(csp0s < sp0s));
assert(!(csp0s < sp0d));
assert(!(csp0d < sp0s));
assert( (csp0d < sp1d));
assert( (csp0s < sp1s));
assert( (csp0s < sp1d));
assert( (csp0d < sp1s));
assert(!(csp1d < sp1s));
assert(!(csp1s < sp1d));
assert(!(csp2d < sp3d));
assert(!(csp2s < sp3s));
assert(!(csp2d < sp3s));
@@ -138,7 +138,7 @@ int main () {
assert( (csp2s < sp4s));
assert( (csp2d < sp4s));
assert( (csp2s < sp4d));
assert(!(csp4d < sp2d));
assert(!(csp4s < sp2s));
assert(!(csp4d < sp2s));
@@ -150,5 +150,5 @@ int main () {
assert(!(std::span<float>{fArr2} < std::span<int>{iArr2}));
assert(!(std::span<int>{iArr2} < std::span<float>{fArr2}));
static_assert(!(std::span<const int>{iArr1, 9} < std::span<const float>{fArr1, 8}), "");
}
static_assert(!(std::span<const int>{iArr1, 9} < std::span<const float>{fArr1, 8}), "");
}

View File

@@ -7,13 +7,13 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// template<class T, ptrdiff_t X, class U, ptrdiff_t Y>
// constexpr bool operator!=(span<T, X> l, span<U, Y> r);
//
//
//
// Effects: Equivalent to: return !(l == r);
//
@@ -30,7 +30,7 @@ constexpr int iArr1[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
int iArr2[] = { 0, 1, 2, 1, 2, 5, 6, 7, 8, 9};
constexpr float fArr1[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
float fArr2[] = {0., 1., 2., 1., 2., 5., 6., 7., 8., 9.};
int main () {
@@ -50,15 +50,15 @@ int main () {
static_assert(!(csp0s != csp0s), "");
static_assert(!(csp0s != csp0d), "");
static_assert(!(csp0d != csp0s), "");
static_assert( (csp0d != csp1d), "");
static_assert( (csp0s != csp1s), "");
static_assert( (csp0s != csp1d), "");
static_assert( (csp0d != csp1s), "");
static_assert(!(csp1d != csp1s), "");
static_assert(!(csp1s != csp1d), "");
static_assert(!(csp2d != csp3d), "");
static_assert(!(csp2s != csp3s), "");
static_assert(!(csp2d != csp3s), "");
@@ -95,15 +95,15 @@ int main () {
assert(!(sp0s != sp0s));
assert(!(sp0s != sp0d));
assert(!(sp0d != sp0s));
assert( (sp0d != sp1d));
assert( (sp0s != sp1s));
assert( (sp0s != sp1d));
assert( (sp0d != sp1s));
assert(!(sp1d != sp1s));
assert(!(sp1s != sp1d));
assert(!(sp2d != sp3d));
assert(!(sp2s != sp3s));
assert(!(sp2d != sp3s));
@@ -129,15 +129,15 @@ int main () {
assert(!(csp0s != sp0s));
assert(!(csp0s != sp0d));
assert(!(csp0d != sp0s));
assert( (csp0d != sp1d));
assert( (csp0s != sp1s));
assert( (csp0s != sp1d));
assert( (csp0d != sp1s));
assert(!(csp1d != sp1s));
assert(!(csp1s != sp1d));
assert(!(csp2d != sp3d));
assert(!(csp2s != sp3s));
assert(!(csp2d != sp3s));
@@ -152,7 +152,7 @@ int main () {
assert( (csp2s != sp4s));
assert( (csp2d != sp4s));
assert( (csp2s != sp4d));
assert( (csp4d != sp2d));
assert( (csp4s != sp2s));
assert( (csp4d != sp2s));
@@ -165,4 +165,4 @@ int main () {
assert(!(std::span<int>{iArr2} != std::span<float>{fArr2}));
static_assert( (std::span<const int>{iArr1, 9} != std::span<const float>{fArr1, 8}), "");
}
}

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -16,7 +16,7 @@
// template<size_t N>
// constexpr span(array<value_type, N>& arr) noexcept;
// template<size_t N>
// constexpr span(const array<value_type, N>& arr) noexcept;
// constexpr span(const array<value_type, N>& arr) noexcept;
//
// Remarks: These constructors shall not participate in overload resolution unless:
// — extent == dynamic_extent || N == extent is true, and
@@ -41,13 +41,13 @@ int main ()
{
std::span<int, 2> s1(arr); // expected-error {{no matching constructor for initialization of 'std::span<int, 2>'}}
}
// Type wrong
{
std::span<float> s1(arr); // expected-error {{no matching constructor for initialization of 'std::span<float>'}}
std::span<float, 3> s2(arr); // expected-error {{no matching constructor for initialization of 'std::span<float, 3>'}}
}
// CV wrong (dynamically sized)
{
std::span< int> s1{ carr}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -71,7 +71,7 @@ int main ()
};
static_assert(std::size(spans) == 13, "" );
// No for loops in constexpr land :-(
static_assert(doAssign(spans[0], spans[0]), "");
static_assert(doAssign(spans[0], spans[1]), "");
@@ -194,7 +194,7 @@ int main ()
{carr2 + 1, 2},
{carr3, 2}
};
static_assert(std::size(spans) == 6, "" );
// No for loops in constexpr land :-(
@@ -240,7 +240,7 @@ int main ()
{arr, arr + 3},
{arr + 1, arr + 3} // same size as s2
};
for (size_t i = 0; i < std::size(spans); ++i)
for (size_t j = i; j < std::size(spans); ++j)
assert((doAssign(spans[i], spans[j])));
@@ -253,7 +253,7 @@ int main ()
{arr + 1, arr + 3},
{arr + 2, arr + 4}
};
for (size_t i = 0; i < std::size(spans); ++i)
for (size_t j = i; j < std::size(spans); ++j)
assert((doAssign(spans[i], spans[j])));
@@ -273,7 +273,7 @@ int main ()
{strs + 2, strs + 3},
{strs + 3, strs + 3}
};
for (size_t i = 0; i < std::size(spans); ++i)
for (size_t j = i; j < std::size(spans); ++j)
assert((doAssign(spans[i], spans[j])));
@@ -285,7 +285,7 @@ int main ()
{strs + 1, strs + 2},
{strs + 2, strs + 3}
};
for (size_t i = 0; i < std::size(spans); ++i)
for (size_t j = i; j < std::size(spans); ++j)
assert((doAssign(spans[i], spans[j])));

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -89,7 +89,7 @@ int main ()
// Not the same type
{
std::span<float> s1{IsAContainer<int>()}; // expected-error {{no matching constructor for initialization of 'std::span<float>'}}
std::span<float, 0> s2{IsAContainer<int>()}; // expected-error {{no matching constructor for initialization of 'std::span<float, 0>'}}
std::span<float, 0> s2{IsAContainer<int>()}; // expected-error {{no matching constructor for initialization of 'std::span<float, 0>'}}
}
// CV wrong (dynamically sized)

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -46,7 +46,7 @@ void testCV ()
int main ()
{
constexpr int carr[] = {1,2,3};
static_assert(doCopy(std::span< int> ()), "");
static_assert(doCopy(std::span< int,0>()), "");
static_assert(doCopy(std::span<const int> (&carr[0], 1)), "");

View File

@@ -7,22 +7,22 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// template<class T, size_t N>
// span(T (&)[N]) -> span<T, N>;
//
//
// template<class T, size_t N>
// span(array<T, N>&) -> span<T, N>;
//
//
// template<class T, size_t N>
// span(const array<T, N>&) -> span<const T, N>;
//
//
// template<class Container>
// span(Container&) -> span<typename Container::value_type>;
//
//
// template<class Container>
// span(const Container&) -> span<const typename Container::value_type>;
@@ -66,7 +66,7 @@ int main ()
ASSERT_SAME_TYPE(S, std::span<const long, 5>);
assert((std::equal(std::begin(arr), std::end(arr), s.begin(), s.end())));
}
{
std::string str{"ABCDE"};
std::span s{str};

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -26,7 +26,7 @@
int main ()
{
std::span<int, 2> s; // expected-error@span:* {{static_assert failed "Can't default construct a statically sized span with size > 0"}}
// TODO: This is what I want:
// eXpected-error {{no matching constructor for initialization of 'std::span<int, 2>'}}
}

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>

View File

@@ -7,12 +7,12 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// constexpr span(pointer ptr, index_type count);
// Requires: [ptr, ptr + count) shall be a valid range.
// Requires: [ptr, ptr + count) shall be a valid range.
// If extent is not equal to dynamic_extent, then count shall be equal to extent.
//
@@ -38,7 +38,7 @@ int main ()
std::span<float> s1(arr, 3); // expected-error {{no matching constructor for initialization of 'std::span<float>'}}
std::span<float, 3> s2(arr, 3); // expected-error {{no matching constructor for initialization of 'std::span<float, 3>'}}
}
// CV wrong (dynamically sized)
{
std::span< int> s1{ carr, 3}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}

View File

@@ -7,12 +7,12 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// constexpr span(pointer ptr, index_type count);
// Requires: [ptr, ptr + count) shall be a valid range.
// Requires: [ptr, ptr + count) shall be a valid range.
// If extent is not equal to dynamic_extent, then count shall be equal to extent.
//

View File

@@ -7,12 +7,12 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// constexpr span(pointer first, pointer last);
// Requires: [first, last) shall be a valid range.
// Requires: [first, last) shall be a valid range.
// If extent is not equal to dynamic_extent, then last - first shall be equal to extent.
//
@@ -38,7 +38,7 @@ int main ()
std::span<float> s1(arr, arr + 3); // expected-error {{no matching constructor for initialization of 'std::span<float>'}}
std::span<float, 3> s2(arr, arr + 3); // expected-error {{no matching constructor for initialization of 'std::span<float, 3>'}}
}
// CV wrong (dynamically sized)
{
std::span< int> s1{ carr, carr + 3}; // expected-error {{no matching constructor for initialization of 'std::span<int>'}}

View File

@@ -7,12 +7,12 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// constexpr span(pointer first, pointer last);
// Requires: [first, last) shall be a valid range.
// Requires: [first, last) shall be a valid range.
// If extent is not equal to dynamic_extent, then last - first shall be equal to extent.
//

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -99,6 +99,6 @@ int main ()
std::span<float> s2{sp0}; // expected-error {{no matching constructor for initialization of 'std::span<float>'}}
std::span<float, 0> s3{sp}; // expected-error {{no matching constructor for initialization of 'std::span<float, 0>'}}
std::span<float, 0> s4{sp0}; // expected-error {{no matching constructor for initialization of 'std::span<float, 0>'}}
checkCV();
}

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>

View File

@@ -7,14 +7,14 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
// template<size_t N>
// constexpr span(array<value_type, N>& arr) noexcept;
// template<size_t N>
// constexpr span(const array<value_type, N>& arr) noexcept;
// constexpr span(const array<value_type, N>& arr) noexcept;
//
// Remarks: These constructors shall not participate in overload resolution unless:
// — extent == dynamic_extent || N == extent is true, and

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -28,7 +28,7 @@ constexpr bool testConstexprSpan(Span sp, ptrdiff_t idx)
{
_LIBCPP_ASSERT(noexcept(sp[idx]), "");
_LIBCPP_ASSERT(noexcept(sp(idx)), "");
typename Span::reference r1 = sp[idx];
typename Span::reference r2 = sp(idx);
typename Span::reference r3 = *(sp.data() + idx);
@@ -41,7 +41,7 @@ void testRuntimeSpan(Span sp, ptrdiff_t idx)
{
_LIBCPP_ASSERT(noexcept(sp[idx]), "");
_LIBCPP_ASSERT(noexcept(sp(idx)), "");
typename Span::reference r1 = sp[idx];
typename Span::reference r2 = sp(idx);
typename Span::reference r3 = *(sp.data() + idx);

View File

@@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>

View File

@@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>

View File

@@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>

View File

@@ -6,7 +6,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -38,7 +38,7 @@ void testRuntimeSpan(Span sp)
assert(spBytes.extent == std::dynamic_extent);
else
assert(spBytes.extent == static_cast<std::ptrdiff_t>(sizeof(typename Span::element_type)) * sp.extent);
assert((void *) spBytes.data() == (void *) sp.data());
assert(spBytes.size() == sp.size_bytes());
}

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -38,7 +38,7 @@ void testRuntimeSpan(Span sp)
assert(spBytes.extent == std::dynamic_extent);
else
assert(spBytes.extent == static_cast<std::ptrdiff_t>(sizeof(typename Span::element_type)) * sp.extent);
assert(static_cast<void*>(spBytes.data()) == static_cast<void*>(sp.data()));
assert(spBytes.size() == sp.size_bytes());
}

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -48,7 +48,7 @@ int main ()
static_assert(!std::span<const int>(iArr1, 3).empty(), "");
static_assert(!std::span<const int>(iArr1, 4).empty(), "");
static_assert(!std::span<const int>(iArr1, 5).empty(), "");
assert( (std::span<int>().empty() ));
assert( (std::span<long>().empty() ));
assert( (std::span<double>().empty() ));

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -114,7 +114,7 @@ int main ()
{
using Sp = std::span<std::string>;
testConstexprSpan<Sp, 0>(Sp{});
testRuntimeSpan<Sp, 0>(Sp{sarr});
testRuntimeSpan<Sp, 1>(Sp{sarr});
testRuntimeSpan<Sp, 2>(Sp{sarr});
@@ -125,7 +125,7 @@ int main ()
{
using Sp = std::span<std::string, 5>;
testRuntimeSpan<Sp, 0>(Sp{sarr});
testRuntimeSpan<Sp, 1>(Sp{sarr});
testRuntimeSpan<Sp, 2>(Sp{sarr});

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -114,7 +114,7 @@ int main ()
{
using Sp = std::span<std::string>;
testConstexprSpan<Sp, 0>(Sp{});
testRuntimeSpan<Sp, 0>(Sp{sarr});
testRuntimeSpan<Sp, 1>(Sp{sarr});
testRuntimeSpan<Sp, 2>(Sp{sarr});
@@ -125,7 +125,7 @@ int main ()
{
using Sp = std::span<std::string, 5>;
testRuntimeSpan<Sp, 0>(Sp{sarr});
testRuntimeSpan<Sp, 1>(Sp{sarr});
testRuntimeSpan<Sp, 2>(Sp{sarr});

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// <span>
@@ -25,9 +25,9 @@
// using const_iterator = implementation-defined;
// using reverse_iterator = std::reverse_iterator<iterator>;
// using const_reverse_iterator = std::reverse_iterator<const_iterator>;
//
//
// static constexpr index_type extent = Extent;
//
//
#include <span>
#include <cassert>
@@ -71,7 +71,7 @@ void testSpan()
ASSERT_SAME_TYPE(typename S::difference_type, std::ptrdiff_t);
ASSERT_SAME_TYPE(typename S::pointer, ElementType *);
ASSERT_SAME_TYPE(typename S::reference, ElementType &);
static_assert(S::extent == Size); // check that it exists
testIterator<S, typename S::iterator>();

View File

@@ -7,7 +7,7 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//
// <execution> feature macros
/* Constant Value

View File

@@ -25,7 +25,7 @@ test(const Allocator& a)
typedef std::match_results<const CharT*, Allocator> SM;
SM m0(a);
SM m1(m0);
assert(m1.size() == m0.size());
assert(m1.str() == m0.str());
assert(m1.get_allocator() == m0.get_allocator());

View File

@@ -25,7 +25,7 @@ test(const Allocator& a)
typedef std::match_results<const CharT*, Allocator> SM;
SM m0(a);
SM m1;
m1 = m0;
assert(m1.size() == m0.size());
assert(m1.str() == m0.str());

View File

@@ -26,7 +26,7 @@ test(const Allocator& a)
typedef std::match_results<const CharT*, Allocator> SM;
SM m0(a);
SM m1;
m1 = std::move(m0);
assert(m1.size() == 0);
assert(m1.str() == std::basic_string<CharT>());

View File

@@ -25,7 +25,7 @@
// const Allocator& = Allocator())
// -> basic_string<charT, traits, Allocator>;
//
// A size_type parameter type in a basic_string deduction guide refers to the size_type
// A size_type parameter type in a basic_string deduction guide refers to the size_type
// member type of the type deduced by the deduction guide.
//
// The deduction guide shall not participate in overload resolution if Allocator

View File

@@ -25,7 +25,7 @@
// const Allocator& = Allocator())
// -> basic_string<charT, traits, Allocator>;
//
// A size_type parameter type in a basic_string deduction guide refers to the size_type
// A size_type parameter type in a basic_string deduction guide refers to the size_type
// member type of the type deduced by the deduction guide.
//
// The deduction guide shall not participate in overload resolution if Allocator

View File

@@ -17,7 +17,7 @@ T euclidian_addition(T rhs, T lhs)
{
const T modulus = maxValue - minValue + 1;
T ret = rhs + lhs;
if (ret > maxValue)
if (ret > maxValue)
ret -= modulus;
return ret;
}
@@ -31,10 +31,9 @@ T euclidian_subtraction(T lhs, T rhs)
{
const T modulus = maxValue - minValue + 1;
T ret = lhs - rhs;
if (ret < minValue)
if (ret < minValue)
ret += modulus;
if (ret > maxValue) // this can happen if T is unsigned
ret += modulus;
return ret;
}

View File

@@ -31,13 +31,13 @@ int main()
ASSERT_NOEXCEPT(day{});
ASSERT_NOEXCEPT(day(0U));
ASSERT_NOEXCEPT(static_cast<unsigned>(day(0U)));
constexpr day d0{};
static_assert(static_cast<unsigned>(d0) == 0, "");
constexpr day d1{1};
static_assert(static_cast<unsigned>(d1) == 1, "");
for (unsigned i = 0; i <= 255; ++i)
{
day day(i);

View File

@@ -39,7 +39,7 @@ int main()
ASSERT_SAME_TYPE(day , decltype( std::declval<day&>()++));
ASSERT_SAME_TYPE(day&, decltype(++std::declval<day&>() ));
static_assert(testConstexpr<day>(), "");
for (unsigned i = 10; i <= 20; ++i)

View File

@@ -43,7 +43,7 @@ int main()
ASSERT_SAME_TYPE(day&, decltype(std::declval<day&>() += std::declval<days>()));
ASSERT_SAME_TYPE(day&, decltype(std::declval<day&>() -= std::declval<days>()));
static_assert(testConstexpr<day, days>(), "");
for (unsigned i = 0; i <= 10; ++i)

View File

@@ -30,14 +30,14 @@ int main()
AssertComparisons6AreNoexcept<day>();
AssertComparisons6ReturnBool<day>();
static_assert(testComparisons6Values<day>(0U, 0U), "");
static_assert(testComparisons6Values<day>(0U, 1U), "");
// Some 'ok' values as well
static_assert(testComparisons6Values<day>( 5U, 5U), "");
static_assert(testComparisons6Values<day>( 5U, 10U), "");
for (unsigned i = 1; i < 10; ++i)
for (unsigned j = 1; j < 10; ++j)
assert(testComparisons6Values<day>(i, j));

View File

@@ -44,7 +44,7 @@ int main()
ASSERT_SAME_TYPE(day, decltype(std::declval<day>() - std::declval<days>()));
ASSERT_SAME_TYPE(days, decltype(std::declval<day>() - std::declval<day>()));
static_assert(testConstexpr<day, days>(), "");
day dy{12};

View File

@@ -44,7 +44,7 @@ int main()
ASSERT_SAME_TYPE(day, decltype(std::declval<day>() + std::declval<days>()));
ASSERT_SAME_TYPE(day, decltype(std::declval<days>() + std::declval<day>()));
static_assert(testConstexpr<day, days>(), "");
day dy{12};

View File

@@ -15,31 +15,31 @@
// template<class charT, class traits>
// basic_ostream<charT, traits>&
// operator<<(basic_ostream<charT, traits>& os, const day& d);
//
// Effects: Inserts format(fmt, d) where fmt is "%d" widened to charT.
//
// Effects: Inserts format(fmt, d) where fmt is "%d" widened to charT.
// If !d.ok(), appends with " is not a valid day".
//
//
// template<class charT, class traits>
// basic_ostream<charT, traits>&
// to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const day& d);
//
// Effects: Streams d into os using the format specified by the NTCTS fmt.
//
// Effects: Streams d into os using the format specified by the NTCTS fmt.
// fmt encoding follows the rules specified in 25.11.
//
//
// template<class charT, class traits, class Alloc = allocator<charT>>
// basic_istream<charT, traits>&
// from_stream(basic_istream<charT, traits>& is, const charT* fmt,
// day& d, basic_string<charT, traits, Alloc>* abbrev = nullptr,
// minutes* offset = nullptr);
//
//
// Effects: Attempts to parse the input stream is into the day d using the format flags
// given in the NTCTS fmt as specified in 25.12.
// given in the NTCTS fmt as specified in 25.12.
// If the parse fails to decode a valid day, is.setstate(ios_base::failbit)
// shall be called and d shall not be modified.
// shall be called and d shall not be modified.
// If %Z is used and successfully parsed, that value will be assigned to *abbrev
// if abbrev is non-null. If %z (or a modified variant) is used and
// successfully parsed, that value will be assigned to *offset if offset is non-null.
//
//
#include <chrono>

View File

@@ -20,7 +20,7 @@
int main()
{
using day = std::chrono::day;
static_assert(std::is_trivially_copyable_v<day>, "");
static_assert(std::is_standard_layout_v<day>, "");
}

View File

@@ -25,7 +25,7 @@
int main()
{
using last_spec = std::chrono::last_spec;
ASSERT_SAME_TYPE(const last_spec, decltype(std::chrono::last));
static_assert(std::is_trivially_copyable_v<last_spec>, "");

View File

@@ -19,7 +19,7 @@
// constexpr chrono::month month() const noexcept;
// constexpr chrono::day day() const noexcept;
// constexpr bool ok() const noexcept;
#include <chrono>
#include <type_traits>
#include <cassert>
@@ -34,7 +34,7 @@ int main()
ASSERT_NOEXCEPT(month_day{});
ASSERT_NOEXCEPT(month_day{month{1}, day{1}});
constexpr month_day md0{};
static_assert( md0.month() == month{}, "");
static_assert( md0.day() == day{}, "");

View File

@@ -13,7 +13,7 @@
// constexpr bool ok() const noexcept;
// Returns: true if m_.ok() is true, 1d <= d_, and d_ is less than or equal to the
// number of days in month m_; otherwise returns false.
// number of days in month m_; otherwise returns false.
// When m_ == February, the number of days is considered to be 29.
#include <chrono>

View File

@@ -15,9 +15,9 @@
// Returns: x.month() == y.month() && x.day() == y.day().
//
// constexpr bool operator< (const month_day& x, const month_day& y) noexcept;
// Returns:
// If x.month() < y.month() returns true.
// Otherwise, if x.month() > y.month() returns false.
// Returns:
// If x.month() < y.month() returns true.
// Otherwise, if x.month() > y.month() returns false.
// Otherwise, returns x.day() < y.day().
#include <chrono>
@@ -35,19 +35,19 @@ int main()
AssertComparisons6AreNoexcept<month_day>();
AssertComparisons6ReturnBool<month_day>();
static_assert( testComparisons6(
month_day{std::chrono::January, day{1}},
month_day{std::chrono::January, day{1}},
month_day{std::chrono::January, day{1}},
true, false), "");
static_assert( testComparisons6(
month_day{std::chrono::January, day{1}},
month_day{std::chrono::January, day{1}},
month_day{std::chrono::January, day{2}},
false, true), "");
static_assert( testComparisons6(
month_day{std::chrono::January, day{1}},
month_day{std::chrono::January, day{1}},
month_day{std::chrono::February, day{1}},
false, true), "");
@@ -55,16 +55,16 @@ int main()
for (unsigned i = 1; i < 12; ++i)
for (unsigned j = 1; j < 12; ++j)
assert((testComparisons6(
month_day{month{i}, day{1}},
month_day{month{j}, day{1}},
month_day{month{i}, day{1}},
month_day{month{j}, day{1}},
i == j, i < j )));
// same month, different days
for (unsigned i = 1; i < 31; ++i)
for (unsigned j = 1; j < 31; ++j)
assert((testComparisons6(
month_day{month{2}, day{i}},
month_day{month{2}, day{j}},
month_day{month{2}, day{i}},
month_day{month{2}, day{j}},
i == j, i < j )));
}

View File

@@ -15,14 +15,14 @@
// template<class charT, class traits>
// basic_ostream<charT, traits>&
// operator<<(basic_ostream<charT, traits>& os, const month_day& md);
//
//
// Returns: os << md.month() << '/' << md.day().
//
//
// template<class charT, class traits>
// basic_ostream<charT, traits>&
// to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const month_day& md);
//
// Effects: Streams md into os using the format specified by the NTCTS fmt.
//
// Effects: Streams md into os using the format specified by the NTCTS fmt.
// fmt encoding follows the rules specified in 25.11.

View File

@@ -20,7 +20,7 @@
int main()
{
using month_day = std::chrono::month_day;
static_assert(std::is_trivially_copyable_v<month_day>, "");
static_assert(std::is_standard_layout_v<month_day>, "");
}

View File

@@ -32,7 +32,7 @@ int main()
AssertComparisons6AreNoexcept<month_day_last>();
AssertComparisons6ReturnBool<month_day_last>();
static_assert( testComparisons6Values<month_day_last>(month{1}, month{1}), "");
static_assert( testComparisons6Values<month_day_last>(month{1}, month{2}), "");

View File

@@ -17,7 +17,7 @@
//
// constexpr chrono::month month() const noexcept;
// constexpr bool ok() const noexcept;
#include <chrono>
#include <type_traits>
#include <cassert>
@@ -30,7 +30,7 @@ int main()
using month_day_last = std::chrono::month_day_last;
ASSERT_NOEXCEPT(month_day_last{month{1}});
constexpr month_day_last md0{month{}};
static_assert( md0.month() == month{}, "");
static_assert(!md0.ok(), "");

View File

@@ -15,7 +15,7 @@
// template<class charT, class traits>
// basic_ostream<charT, traits>&
// operator<<(basic_ostream<charT, traits>& os, const month_day_last& mdl);
//
//
// Returns: os << mdl.month() << "/last".

View File

@@ -21,7 +21,7 @@
int main()
{
using month_day_last = std::chrono::month_day_last;
static_assert(std::is_trivially_copyable_v<month_day_last>, "");
static_assert(std::is_standard_layout_v<month_day_last>, "");
}

View File

@@ -31,13 +31,13 @@ int main()
ASSERT_NOEXCEPT(month{});
ASSERT_NOEXCEPT(month(1));
ASSERT_NOEXCEPT(static_cast<unsigned>(month(1)));
constexpr month m0{};
static_assert(static_cast<unsigned>(m0) == 0, "");
constexpr month m1{1};
static_assert(static_cast<unsigned>(m1) == 1, "");
for (unsigned i = 0; i <= 255; ++i)
{
month m(i);

View File

@@ -34,13 +34,13 @@ constexpr bool testConstexpr()
int main()
{
using month = std::chrono::month;
ASSERT_NOEXCEPT(--(std::declval<month&>()) );
ASSERT_NOEXCEPT( (std::declval<month&>())--);
ASSERT_SAME_TYPE(month , decltype( std::declval<month&>()--));
ASSERT_SAME_TYPE(month&, decltype(--std::declval<month&>() ));
static_assert(testConstexpr<month>(), "");
for (unsigned i = 10; i <= 20; ++i)

View File

@@ -39,7 +39,7 @@ int main()
ASSERT_SAME_TYPE(month , decltype( std::declval<month&>()++));
ASSERT_SAME_TYPE(month&, decltype(++std::declval<month&>() ));
static_assert(testConstexpr<month>(), "");
for (unsigned i = 0; i <= 10; ++i)

View File

@@ -42,7 +42,7 @@ int main()
ASSERT_NOEXCEPT(std::declval<month&>() -= std::declval<months&>());
ASSERT_SAME_TYPE(month&, decltype(std::declval<month&>() += std::declval<months&>()));
ASSERT_SAME_TYPE(month&, decltype(std::declval<month&>() -= std::declval<months&>()));
static_assert(testConstexpr<month, months>(), "");
for (unsigned i = 1; i <= 10; ++i)

View File

@@ -36,11 +36,11 @@ int main()
static_assert(testComparisons6Values<month>(0U ,0U), "");
static_assert(testComparisons6Values<month>(0U, 1U), "");
// Some 'ok' values as well
static_assert(testComparisons6Values<month>( 5U, 5U), "");
static_assert(testComparisons6Values<month>( 5U, 10U), "");
for (unsigned i = 1; i < 10; ++i)
for (unsigned j = 10; j < 10; ++j)
assert(testComparisons6Values<month>(i, j));

View File

@@ -15,9 +15,9 @@
// Returns: x + -y.
//
// constexpr months operator-(const month& x, const month& y) noexcept;
// Returns: If x.ok() == true and y.ok() == true, returns a value m in the range
// [months{0}, months{11}] satisfying y + m == x.
// Otherwise the value returned is unspecified.
// Returns: If x.ok() == true and y.ok() == true, returns a value m in the range
// [months{0}, months{11}] satisfying y + m == x.
// Otherwise the value returned is unspecified.
// [Example: January - February == months{11}. —end example]
extern "C" int printf(const char *, ...);
@@ -55,7 +55,7 @@ int main()
ASSERT_SAME_TYPE(month , decltype(std::declval<month>() - std::declval<months>()));
ASSERT_SAME_TYPE(months, decltype(std::declval<month>() - std::declval<month> ()));
static_assert(testConstexpr<month, months>(), "");
month m{6};

View File

@@ -17,9 +17,9 @@
// constexpr month operator+(const months& x, const month& y) noexcept;
// Returns:
// month{modulo(static_cast<long long>(int{x}) + (y.count() - 1), 12) + 1}
// where modulo(n, 12) computes the remainder of n divided by 12 using Euclidean division.
// where modulo(n, 12) computes the remainder of n divided by 12 using Euclidean division.
// [Note: Given a divisor of 12, Euclidean division truncates towards negative infinity
// and always produces a remainder in the range of [0, 11].
// and always produces a remainder in the range of [0, 11].
// Assuming no overflow in the signed summation, this operation results in a month
// holding a value in the range [1, 12] even if !x.ok(). —end note]
// [Example: February + months{11} == January. —end example]
@@ -54,7 +54,7 @@ int main()
ASSERT_SAME_TYPE(month, decltype(std::declval<month>() + std::declval<months>()));
ASSERT_SAME_TYPE(month, decltype(std::declval<months>() + std::declval<month>() ));
static_assert(testConstexpr<month, months>(), "");
month my{2};

View File

@@ -15,28 +15,28 @@
// template<class charT, class traits>
// basic_ostream<charT, traits>&
// operator<<(basic_ostream<charT, traits>& os, const month& m);
//
// Effects: If m.ok() == true inserts format(os.getloc(), fmt, m) where fmt is "%b" widened to charT.
//
// Effects: If m.ok() == true inserts format(os.getloc(), fmt, m) where fmt is "%b" widened to charT.
// Otherwise inserts int{m} << " is not a valid month".
//
//
// template<class charT, class traits>
// basic_ostream<charT, traits>&
// to_stream(basic_ostream<charT, traits>& os, const charT* fmt, const month& m);
//
// Effects: Streams m into os using the format specified by the NTCTS fmt.
//
// Effects: Streams m into os using the format specified by the NTCTS fmt.
// fmt encoding follows the rules specified in 25.11.
//
//
// template<class charT, class traits, class Alloc = allocator<charT>>
// basic_istream<charT, traits>&
// from_stream(basic_istream<charT, traits>& is, const charT* fmt,
// month& m, basic_string<charT, traits, Alloc>* abbrev = nullptr,
// minutes* offset = nullptr);
//
// Effects: Attempts to parse the input stream is into the month m using the format flags
//
// Effects: Attempts to parse the input stream is into the month m using the format flags
// given in the NTCTS fmt as specified in 25.12. If the parse fails to decode a valid month,
// is.setstate(ios_- base::failbit) shall be called and m shall not be modified.
// If %Z is used and successfully parsed, that value will be assigned to *abbrev if
// abbrev is non-null. If %z (or a modified variant) is used and successfully parsed,
// is.setstate(ios_- base::failbit) shall be called and m shall not be modified.
// If %Z is used and successfully parsed, that value will be assigned to *abbrev if
// abbrev is non-null. If %z (or a modified variant) is used and successfully parsed,
// that value will be assigned to *offset if offset is non-null.
#include <chrono>

View File

@@ -20,7 +20,7 @@
int main()
{
using month = std::chrono::month;
static_assert(std::is_trivially_copyable_v<month>, "");
static_assert(std::is_standard_layout_v<month>, "");
}

View File

@@ -18,7 +18,7 @@
// constexpr chrono::month month() const noexcept;
// constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
// constexpr bool ok() const noexcept;
#include <chrono>
#include <type_traits>
#include <cassert>
@@ -33,7 +33,7 @@ int main()
using weekday_indexed = std::chrono::weekday_indexed;
ASSERT_NOEXCEPT(month_weekday{month{1}, weekday_indexed{weekday{}, 1}});
constexpr month_weekday md0{month{}, weekday_indexed{}};
static_assert( md0.month() == month{}, "");
static_assert( md0.weekday_indexed() == weekday_indexed{}, "");

View File

@@ -34,12 +34,12 @@ int main()
AssertComparisons2AreNoexcept<month_weekday>();
AssertComparisons2ReturnBool<month_weekday>();
static_assert( testComparisons2(
month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}},
month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}},
month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}},
true), "");
static_assert( testComparisons2(
month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}},
month_weekday{std::chrono::January, weekday_indexed{Sunday, 2}},
@@ -64,23 +64,23 @@ int main()
for (unsigned i = 1; i < 12; ++i)
for (unsigned j = 1; j < 12; ++j)
assert((testComparisons2(
month_weekday{month{i}, weekday_indexed{Sunday, 1}},
month_weekday{month{j}, weekday_indexed{Sunday, 1}},
month_weekday{month{i}, weekday_indexed{Sunday, 1}},
month_weekday{month{j}, weekday_indexed{Sunday, 1}},
i == j)));
// same month, different weeks
for (unsigned i = 1; i < 5; ++i)
for (unsigned j = 1; j < 5; ++j)
assert((testComparisons2(
month_weekday{month{2}, weekday_indexed{Sunday, i}},
month_weekday{month{2}, weekday_indexed{Sunday, j}},
month_weekday{month{2}, weekday_indexed{Sunday, i}},
month_weekday{month{2}, weekday_indexed{Sunday, j}},
i == j)));
// same month, different days
for (unsigned i = 0; i < 6; ++i)
for (unsigned j = 0; j < 6; ++j)
assert((testComparisons2(
month_weekday{month{2}, weekday_indexed{weekday{i}, 2}},
month_weekday{month{2}, weekday_indexed{weekday{j}, 2}},
month_weekday{month{2}, weekday_indexed{weekday{i}, 2}},
month_weekday{month{2}, weekday_indexed{weekday{j}, 2}},
i == j)));
}

View File

@@ -15,7 +15,7 @@
// template<class charT, class traits>
// basic_ostream<charT, traits>&
// operator<<(basic_ostream<charT, traits>& os, const month_weekday& mwd);
//
//
// Returns: os << mwd.month() << '/' << mwd.weekday_indexed().
#include <chrono>
@@ -31,6 +31,6 @@ int main()
using month = std::chrono::month;
using weekday_indexed = std::chrono::weekday_indexed;
using weekday = std::chrono::weekday;
std::cout << month_weekday{month{1}, weekday_indexed{weekday{3}, 3}};
}

View File

@@ -20,7 +20,7 @@
int main()
{
using month_weekday = std::chrono::month_weekday;
static_assert(std::is_trivially_copyable_v<month_weekday>, "");
static_assert(std::is_standard_layout_v<month_weekday>, "");
}

View File

@@ -20,8 +20,8 @@
// constexpr chrono::month month() const noexcept;
// constexpr chrono::weekday_last weekday_last() const noexcept;
// constexpr bool ok() const noexcept;
#include <chrono>
#include <type_traits>
#include <cassert>
@@ -39,7 +39,7 @@ int main()
constexpr weekday Tuesday = std::chrono::Tuesday;
ASSERT_NOEXCEPT(month_weekday_last{January, weekday_last{Tuesday}});
// bad month
constexpr month_weekday_last mwdl1{month{}, weekday_last{Tuesday}};
static_assert( mwdl1.month() == month{}, "");

View File

@@ -40,12 +40,12 @@ int main()
AssertComparisons2ReturnBool<month_weekday_last>();
static_assert( testComparisons2(
month_weekday_last{std::chrono::January, weekday_last{Tuesday}},
month_weekday_last{std::chrono::January, weekday_last{Tuesday}},
month_weekday_last{std::chrono::January, weekday_last{Tuesday}},
true), "");
static_assert( testComparisons2(
month_weekday_last{std::chrono::January, weekday_last{Tuesday}},
month_weekday_last{std::chrono::January, weekday_last{Tuesday}},
month_weekday_last{std::chrono::January, weekday_last{Wednesday}},
false), "");

View File

@@ -15,7 +15,7 @@
// template<class charT, class traits>
// basic_ostream<charT, traits>&
// operator<<(basic_ostream<charT, traits>& os, const month_weekday_last& mdl);
//
//
// Returns: os << mdl.month() << "/last".
@@ -32,6 +32,6 @@ int main()
using month = std::chrono::month;
using weekday = std::chrono::weekday;
using weekday_last = std::chrono::weekday_last;
std::cout << month_weekday_last{month{1}, weekday_last{weekday{3}}};
}

View File

@@ -21,7 +21,7 @@
int main()
{
using month_weekday_last = std::chrono::month_weekday_last;
static_assert(std::is_trivially_copyable_v<month_weekday_last>, "");
static_assert(std::is_standard_layout_v<month_weekday_last>, "");
}

View File

@@ -14,19 +14,19 @@
// constexpr month_day
// operator/(const month& m, const day& d) noexcept;
// Returns: {m, d}.
//
//
// constexpr month_day
// operator/(const day& d, const month& m) noexcept;
// Returns: m / d.
// constexpr month_day
// operator/(const month& m, int d) noexcept;
// Returns: m / day(d).
//
// Returns: m / day(d).
//
// constexpr month_day
// operator/(int m, const day& d) noexcept;
// Returns: month(m) / d.
//
//
// constexpr month_day
// operator/(const day& d, int m) noexcept;
// Returns: month(m) / d.
@@ -46,7 +46,7 @@ int main()
using day = std::chrono::day;
constexpr month February = std::chrono::February;
{ // operator/(const month& m, const day& d) (and switched)
ASSERT_NOEXCEPT ( February/day{1});
ASSERT_SAME_TYPE(month_day, decltype(February/day{1}));

View File

@@ -14,15 +14,15 @@
// constexpr month_day_last
// operator/(const month& m, last_spec) noexcept;
// Returns: month_day_last{m}.
//
//
// constexpr month_day_last
// operator/(int m, last_spec) noexcept;
// Returns: month(m) / last.
//
//
// constexpr month_day_last
// operator/(last_spec, const month& m) noexcept;
// Returns: m / last.
//
// Returns: m / last.
//
// constexpr month_day_last
// operator/(last_spec, int m) noexcept;
// Returns: month(m) / last.
@@ -51,7 +51,7 @@ int main()
{
using month = std::chrono::month;
using month_day_last = std::chrono::month_day_last;
constexpr month February = std::chrono::February;
constexpr std::chrono::last_spec last = std::chrono::last;
@@ -63,7 +63,7 @@ int main()
constexpr auto mdl = February/std::chrono::last;
static_assert(mdl.month() == February, "");
}
{ // operator/(const month& m, last_spec) and switched
ASSERT_NOEXCEPT ( last/February);
ASSERT_SAME_TYPE(month_day_last, decltype(last/February));

View File

@@ -54,7 +54,7 @@ int main()
constexpr weekday Tuesday = std::chrono::Tuesday;
constexpr month February = std::chrono::February;
{ // operator/(const month& m, const weekday_indexed& wdi) (and switched)
ASSERT_NOEXCEPT (February/Tuesday[2]);
ASSERT_SAME_TYPE(month_weekday, decltype(February/Tuesday[2]));
@@ -67,7 +67,7 @@ int main()
static_assert(wdi.month() == February, "");
static_assert(wdi.weekday_indexed() == Tuesday[3], "");
}
for (int i = 1; i <= 12; ++i)
for (unsigned j = 0; j <= 6; ++j)
for (unsigned k = 1; k <= 5; ++k)
@@ -82,7 +82,7 @@ int main()
assert(mwd2.weekday_indexed() == wdi);
assert(mwd1 == mwd2);
}
}
}
{ // operator/(int m, const weekday_indexed& wdi) (and switched)
@@ -97,7 +97,7 @@ int main()
static_assert(wdi.month() == February, "");
static_assert(wdi.weekday_indexed() == Tuesday[3], "");
}
for (int i = 1; i <= 12; ++i)
for (unsigned j = 0; j <= 6; ++j)
for (unsigned k = 1; k <= 5; ++k)
@@ -111,5 +111,5 @@ int main()
assert(mwd2.weekday_indexed() == wdi);
assert(mwd1 == mwd2);
}
}
}
}

View File

@@ -14,15 +14,15 @@
// constexpr month_weekday_last
// operator/(const month& m, const weekday_last& wdl) noexcept;
// Returns: {m, wdl}.
//
//
// constexpr month_weekday_last
// operator/(int m, const weekday_last& wdl) noexcept;
// Returns: month(m) / wdl.
//
//
// constexpr month_weekday_last
// operator/(const weekday_last& wdl, const month& m) noexcept;
// Returns: m / wdl.
//
//
// constexpr month_weekday_last
// operator/(const weekday_last& wdl, int m) noexcept;
// Returns: month(m) / wdl.
@@ -48,7 +48,7 @@ int main()
constexpr weekday Tuesday = std::chrono::Tuesday;
constexpr month February = std::chrono::February;
constexpr std::chrono::last_spec last = std::chrono::last;
{ // operator/(const month& m, const weekday_last& wdi) (and switched)
ASSERT_NOEXCEPT (February/Tuesday[last]);
ASSERT_SAME_TYPE(month_weekday_last, decltype(February/Tuesday[last]));
@@ -61,7 +61,7 @@ int main()
static_assert(wdi.month() == February, "");
static_assert(wdi.weekday_last() == Tuesday[last], "");
}
for (int i = 1; i <= 12; ++i)
for (unsigned j = 0; j <= 6; ++j)
{
@@ -90,7 +90,7 @@ int main()
static_assert(wdi.month() == February, "");
static_assert(wdi.weekday_indexed() == Tuesday[3], "");
}
for (int i = 1; i <= 12; ++i)
for (unsigned j = 0; j <= 6; ++j)
{
@@ -103,5 +103,5 @@ int main()
assert(mwd2.weekday_last() == wdi);
assert(mwd1 == mwd2);
}
}
}
}

View File

@@ -13,7 +13,7 @@
// constexpr year_month operator/(const year& y, const month& m) noexcept;
// Returns: {y, m}.
//
//
// constexpr year_month operator/(const year& y, int m) noexcept;
// Returns: y / month(m).
@@ -56,7 +56,7 @@ int main()
static_assert((year{2018}/2).year() == year{2018}, "");
static_assert((year{2018}/2).month() == month{2}, "");
for (int i = 1000; i <= 1030; ++i)
for (unsigned j = 1; j <= 12; ++j)
{
@@ -64,5 +64,5 @@ int main()
assert(static_cast<int>(ym.year()) == i);
assert(static_cast<unsigned>(ym.month()) == j);
}
}
}
}

View File

@@ -14,23 +14,23 @@
// constexpr year_month_day
// operator/(const year_month& ym, const day& d) noexcept;
// Returns: {ym.year(), ym.month(), d}.
//
//
// constexpr year_month_day
// operator/(const year_month& ym, int d) noexcept;
// Returns: ym / day(d).
//
//
// constexpr year_month_day
// operator/(const year& y, const month_day& md) noexcept;
// Returns: y / md.month() / md.day().
//
//
// constexpr year_month_day
// operator/(int y, const month_day& md) noexcept;
// Returns: year(y) / md.
//
//
// constexpr year_month_day
// operator/(const month_day& md, const year& y) noexcept;
// Returns: y / md.
//
//
// constexpr year_month_day
// operator/(const month_day& md, int y) noexcept;
// Returns: year(y) / md.
@@ -62,7 +62,7 @@ int main()
static_assert((Feb2018/day{2}).month() == February, "");
static_assert((Feb2018/day{2}).day() == day{2}, "");
for (int i = 1000; i < 1010; ++i)
for (int j = 1; j <= 12; ++j)
for (unsigned k = 0; k <= 28; ++k)
@@ -85,7 +85,7 @@ int main()
static_assert((Feb2018/2).month() == February, "");
static_assert((Feb2018/2).day() == day{2}, "");
for (int i = 1000; i < 1010; ++i)
for (int j = 1; j <= 12; ++j)
for (unsigned k = 0; k <= 28; ++k)
@@ -108,7 +108,7 @@ int main()
static_assert((Feb2018/2).month() == February, "");
static_assert((Feb2018/2).day() == day{2}, "");
for (int i = 1000; i < 1010; ++i)
for (int j = 1; j <= 12; ++j)
for (unsigned k = 0; k <= 28; ++k)
@@ -137,7 +137,7 @@ int main()
static_assert((year{2018}/month_day{February, day{2}}).day() == day{2}, "" );
static_assert((month_day{February, day{2}}/year{2018}).month() == February, "" );
static_assert((month_day{February, day{2}}/year{2018}).day() == day{2}, "" );
for (int i = 1000; i < 1010; ++i)
for (int j = 1; j <= 12; ++j)
for (unsigned k = 0; k <= 28; ++k)
@@ -168,7 +168,7 @@ int main()
static_assert((2018/month_day{February, day{2}}).day() == day{2}, "" );
static_assert((month_day{February, day{2}}/2018).month() == February, "" );
static_assert((month_day{February, day{2}}/2018).day() == day{2}, "" );
for (int i = 1000; i < 1010; ++i)
for (int j = 1; j <= 12; ++j)
for (unsigned k = 0; k <= 28; ++k)

View File

@@ -18,15 +18,15 @@
// constexpr year_month_day_last
// operator/(const year& y, const month_day_last& mdl) noexcept;
// Returns: {y, mdl}.
//
//
// constexpr year_month_day_last
// operator/(int y, const month_day_last& mdl) noexcept;
// Returns: year(y) / mdl.
//
//
// constexpr year_month_day_last
// operator/(const month_day_last& mdl, const year& y) noexcept;
// Returns: y / mdl.
//
//
// constexpr year_month_day_last
// operator/(const month_day_last& mdl, int y) noexcept;
// Returns: year(y) / mdl.
@@ -53,10 +53,10 @@ int main()
constexpr month February = std::chrono::February;
constexpr std::chrono::last_spec last = std::chrono::last;
{ // operator/(const year_month& ym, last_spec)
constexpr year_month Feb2018{year{2018}, February};
ASSERT_NOEXCEPT ( Feb2018/last);
ASSERT_SAME_TYPE(year_month_day_last, decltype(Feb2018/last));
@@ -66,7 +66,7 @@ int main()
for (int i = 1000; i < 1010; ++i)
for (unsigned j = 1; j <= 12; ++j)
{
year y{i};
year y{i};
month m{j};
year_month_day_last ymdl = year_month{y,m}/last;
assert(ymdl.year() == y);
@@ -85,11 +85,11 @@ int main()
static_assert((year{2018}/month_day_last{February}).year() == year{2018}, "");
static_assert((month_day_last{February}/year{2018}).month() == February, "");
static_assert((month_day_last{February}/year{2018}).year() == year{2018}, "");
for (int i = 1000; i < 1010; ++i)
for (unsigned j = 1; j <= 12; ++j)
{
year y{i};
year y{i};
month m{j};
year_month_day_last ymdl1 = y/month_day_last{m};
year_month_day_last ymdl2 = month_day_last{m}/y;
@@ -99,7 +99,7 @@ int main()
assert(ymdl1.year() == y);
assert(ymdl1 == ymdl2);
}
}
}
{ // operator/(int y, const month_day_last& mdl) (and switched)
ASSERT_NOEXCEPT ( 2018/month_day_last{February});
@@ -111,11 +111,11 @@ int main()
static_assert((2018/month_day_last{February}).year() == year{2018}, "");
static_assert((month_day_last{February}/2018).month() == February, "");
static_assert((month_day_last{February}/2018).year() == year{2018}, "");
for (int i = 1000; i < 1010; ++i)
for (unsigned j = 1; j <= 12; ++j)
{
year y{i};
year y{i};
month m{j};
year_month_day_last ymdl1 = i/month_day_last{m};
year_month_day_last ymdl2 = month_day_last{m}/i;
@@ -125,5 +125,5 @@ int main()
assert(ymdl1.year() == y);
assert(ymdl1 == ymdl2);
}
}
}
}

View File

@@ -14,19 +14,19 @@
// constexpr year_month_weekday
// operator/(const year_month& ym, const weekday_indexed& wdi) noexcept;
// Returns: {ym.year(), ym.month(), wdi}.
//
//
// constexpr year_month_weekday
// operator/(const year& y, const month_weekday& mwd) noexcept;
// Returns: {y, mwd.month(), mwd.weekday_indexed()}.
//
//
// constexpr year_month_weekday
// operator/(int y, const month_weekday& mwd) noexcept;
// Returns: year(y) / mwd.
//
//
// constexpr year_month_weekday
// operator/(const month_weekday& mwd, const year& y) noexcept;
// Returns: y / mwd.
//
//
// constexpr year_month_weekday
// operator/(const month_weekday& mwd, int y) noexcept;
// Returns: year(y) / mwd.
@@ -52,10 +52,10 @@ int main()
constexpr weekday Tuesday = std::chrono::Tuesday;
constexpr month February = std::chrono::February;
{ // operator/(const year_month& ym, const weekday_indexed& wdi)
constexpr year_month Feb2018{year{2018}, February};
ASSERT_NOEXCEPT ( Feb2018/weekday_indexed{Tuesday, 2});
ASSERT_SAME_TYPE(year_month_weekday, decltype(Feb2018/weekday_indexed{Tuesday, 2}));
@@ -141,5 +141,5 @@ int main()
assert(ymd2.weekday() == wd);
assert(ymd1 == ymd2);
}
}
}
}

View File

@@ -14,19 +14,19 @@
// constexpr year_month_weekday_last
// operator/(const year_month& ym, const weekday_last& wdl) noexcept;
// Returns: {ym.year(), ym.month(), wdl}.
//
//
// constexpr year_month_weekday_last
// operator/(const year& y, const month_weekday_last& mwdl) noexcept;
// Returns: {y, mwdl.month(), mwdl.weekday_last()}.
//
//
// constexpr year_month_weekday_last
// operator/(int y, const month_weekday_last& mwdl) noexcept;
// Returns: year(y) / mwdl.
//
//
// constexpr year_month_weekday_last
// operator/(const month_weekday_last& mwdl, const year& y) noexcept;
// Returns: y / mwdl.
//
//
// constexpr year_month_weekday_last
// operator/(const month_weekday_last& mwdl, int y) noexcept;
// Returns: year(y) / mwdl.
@@ -53,7 +53,7 @@ int main()
constexpr weekday Tuesday = std::chrono::Tuesday;
constexpr month February = std::chrono::February;
{ // operator/(const year_month& ym, const weekday_last& wdl) (and switched)
constexpr year_month Feb2018{year{2018}, February};
@@ -63,7 +63,7 @@ int main()
static_assert((Feb2018/weekday_last{Tuesday}).year() == year{2018}, "");
static_assert((Feb2018/weekday_last{Tuesday}).month() == February, "");
static_assert((Feb2018/weekday_last{Tuesday}).weekday() == Tuesday, "");
for (int i = 1000; i < 1010; ++i)
for (unsigned j = 1; j <= 12; ++j)
for (unsigned k = 0; k <= 6; ++k)
@@ -81,7 +81,7 @@ int main()
{ // operator/(const year& y, const month_weekday_last& mwdl) (and switched)
constexpr month_weekday_last FebLastTues{February, weekday_last{Tuesday}};
ASSERT_NOEXCEPT ( year{2018}/FebLastTues);
ASSERT_SAME_TYPE(year_month_weekday_last, decltype(year{2018}/FebLastTues));
ASSERT_NOEXCEPT ( FebLastTues/year{2018});
@@ -118,7 +118,7 @@ int main()
{ // operator/(int y, const month_weekday_last& mwdl) (and switched)
constexpr month_weekday_last FebLastTues{February, weekday_last{Tuesday}};
ASSERT_NOEXCEPT ( 2018/FebLastTues);
ASSERT_SAME_TYPE(year_month_weekday_last, decltype(2018/FebLastTues));
ASSERT_NOEXCEPT ( FebLastTues/2018);

View File

@@ -20,7 +20,7 @@
// constexpr chrono::weekday weekday() const noexcept;
// constexpr unsigned index() const noexcept;
// constexpr bool ok() const noexcept;
#include <chrono>
#include <type_traits>
#include <cassert>
@@ -34,7 +34,7 @@ int main()
ASSERT_NOEXCEPT(weekday_indexed{});
ASSERT_NOEXCEPT(weekday_indexed(weekday{1}, 1));
constexpr weekday_indexed wdi0{};
static_assert( wdi0.weekday() == weekday{}, "");
static_assert( wdi0.index() == 0, "");
@@ -44,7 +44,7 @@ int main()
static_assert( wdi1.weekday() == std::chrono::Sunday, "");
static_assert( wdi1.index() == 2, "");
static_assert( wdi1.ok(), "");
for (unsigned i = 1; i <= 5; ++i)
{
weekday_indexed wdi(std::chrono::Tuesday, i);

View File

@@ -30,13 +30,13 @@ int main()
AssertComparisons2AreNoexcept<weekday_indexed>();
AssertComparisons2ReturnBool<weekday_indexed>();
static_assert( (weekday_indexed{} == weekday_indexed{}), "");
static_assert(!(weekday_indexed{} != weekday_indexed{}), "");
static_assert(!(weekday_indexed{} == weekday_indexed{std::chrono::Tuesday, 1}), "");
static_assert( (weekday_indexed{} != weekday_indexed{std::chrono::Tuesday, 1}), "");
// Some 'ok' values as well
static_assert( (weekday_indexed{weekday{1}, 2} == weekday_indexed{weekday{1}, 2}), "");
static_assert(!(weekday_indexed{weekday{1}, 2} != weekday_indexed{weekday{1}, 2}), "");

View File

@@ -16,8 +16,8 @@
// basic_ostream<charT, traits>&
// operator<<(basic_ostream<charT, traits>& os, const weekday_indexed& wdi);
//
// Effects: os << wdi.weekday() << '[' << wdi.index().
// If wdi.index() is in the range [1, 5], appends with ']',
// Effects: os << wdi.weekday() << '[' << wdi.index().
// If wdi.index() is in the range [1, 5], appends with ']',
// otherwise appends with " is not a valid index]".
@@ -31,6 +31,6 @@ int main()
{
using weekday_indexed = std::chrono::weekday_indexed;
using weekday = std::chrono::weekday;
std::cout << weekday_indexed{weekday{3}};
}

View File

@@ -20,7 +20,7 @@
int main()
{
using weekday_indexed = std::chrono::weekday_indexed;
static_assert(std::is_trivially_copyable_v<weekday_indexed>, "");
static_assert(std::is_standard_layout_v<weekday_indexed>, "");
}

View File

@@ -30,7 +30,7 @@ int main()
using weekday_last = std::chrono::weekday_last;
ASSERT_NOEXCEPT(weekday_last{weekday{}});
constexpr weekday_last wdl0{weekday{}};
static_assert( wdl0.weekday() == weekday{}, "");
static_assert( wdl0.ok(), "");
@@ -38,7 +38,7 @@ int main()
constexpr weekday_last wdl1 {weekday{1}};
static_assert( wdl1.weekday() == weekday{1}, "");
static_assert( wdl1.ok(), "");
for (unsigned i = 0; i <= 255; ++i)
{
weekday_last wdl{weekday{i}};

View File

@@ -29,14 +29,14 @@ int main()
AssertComparisons2AreNoexcept<weekday_last>();
AssertComparisons2ReturnBool<weekday_last>();
static_assert(testComparisons2Values<weekday_last>(weekday{0}, weekday{0}), "");
static_assert(testComparisons2Values<weekday_last>(weekday{0}, weekday{1}), "");
// Some 'ok' values as well
static_assert(testComparisons2Values<weekday_last>(weekday{2}, weekday{2}), "");
static_assert(testComparisons2Values<weekday_last>(weekday{2}, weekday{3}), "");
for (unsigned i = 0; i < 6; ++i)
for (unsigned j = 0; j < 6; ++j)
assert(testComparisons2Values<weekday_last>(weekday{i}, weekday{j}));

View File

@@ -15,7 +15,7 @@
// template<class charT, class traits>
// basic_ostream<charT, traits>&
// operator<<(basic_ostream<charT, traits>& os, const weekday_last& wdl);
//
//
// Returns: os << wdl.weekday() << "[last]".
#include <chrono>
@@ -29,6 +29,6 @@ int main()
{
using weekday_last = std::chrono::weekday_last;
using weekday = std::chrono::weekday;
std::cout << weekday_last{weekday{3}};
}

View File

@@ -20,7 +20,7 @@
int main()
{
using weekday_last = std::chrono::weekday_last;
static_assert(std::is_trivially_copyable_v<weekday_last>, "");
static_assert(std::is_standard_layout_v<weekday_last>, "");
}

View File

@@ -34,13 +34,13 @@ int main()
ASSERT_NOEXCEPT(weekday{});
ASSERT_NOEXCEPT(weekday(1));
ASSERT_NOEXCEPT(static_cast<unsigned>(weekday(1)));
constexpr weekday m0{};
static_assert(static_cast<unsigned>(m0) == 0, "");
constexpr weekday m1{1};
static_assert(static_cast<unsigned>(m1) == 1, "");
for (unsigned i = 0; i <= 255; ++i)
{
weekday m(i);

Some files were not shown because too many files have changed in this diff Show More