//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // template // class fpos; #include #include #include #include #include "test_macros.h" template struct is_equality_comparable : std::false_type { }; template struct is_equality_comparable () == std::declval(), (void)0)>::type > : std::true_type { }; template void test_traits() { static_assert(std::is_default_constructible >::value, ""); static_assert(std::is_copy_constructible >::value, ""); static_assert(std::is_copy_assignable >::value, ""); static_assert(std::is_destructible >::value, ""); static_assert(is_equality_comparable >::value, ""); static_assert(std::is_trivially_copy_constructible::value == std::is_trivially_copy_constructible >::value, ""); static_assert(std::is_trivially_copy_assignable::value == std::is_trivially_copy_assignable >::value, ""); static_assert(std::is_trivially_destructible::value == std::is_trivially_destructible >::value, ""); } struct Foo { }; int main(int, char**) { test_traits(); test_traits(); test_traits(); // Position type requirements table 106 (in order): std::streampos p1(42); std::streamoff o1(p1); { assert(o1 == 42); } { std::streampos p2(42); std::streampos q1(43); std::streampos const p3(44); std::streampos const q2(45); assert(p2 != q1); assert(p3 != q2); assert(p2 != q2); assert(p3 != q1); } { std::streampos p2 = p1 + o1; assert(p2 == 84); } { std::streampos& p2 = p1 += o1; assert(p2 == 84); assert(p1 == 84); } { std::streampos p2 = p1 - o1; assert(p2 == 42); } { std::streampos& p2 = p1 -= o1; assert(p2 == 42); assert(p1 == 42); } { std::streampos p2 = o1 + p1; assert(p2 == 84); } { std::streampos q1(42); std::streamoff o2 = q1 - p1; assert(o2 == 0); } return 0; }