Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
libcxx/test/std/containers/sequences/array/contiguous.pass.cpp
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// <array> | // <array> | ||||
// An array is a contiguous container | // An array is a contiguous container | ||||
#include <array> | #include <array> | ||||
#include <cassert> | #include <cassert> | ||||
#include <memory> | |||||
#include "test_macros.h" | #include "test_macros.h" | ||||
template <class Container> | template <class Container> | ||||
TEST_CONSTEXPR_CXX14 void assert_contiguous(Container const& c) | TEST_CONSTEXPR_CXX14 void assert_contiguous(Container const& c) | ||||
{ | { | ||||
for (size_t i = 0; i < c.size(); ++i) | for (size_t i = 0; i < c.size(); ++i) | ||||
assert(*(c.begin() + i) == *(std::addressof(*c.begin()) + i)); | assert(*(c.begin() + i) == *(std::addressof(*c.begin()) + i)); | ||||
Show All 25 Lines |