[libcxx-commits] [PATCH] D72036: [libcxx] span: Cleanup includes

Michael Schellenberger Costa via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 31 04:52:32 PST 2019


miscco created this revision.
miscco added reviewers: ldionne, EricWF, mclow.lists.
Herald added subscribers: libcxx-commits, dexonsmith, christof.
Herald added a project: libc++.

Remove the duplicated include of <cstddef> and forward declare std::array rather than dragging in the header.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72036

Files:
  libcxx/include/span
  libcxx/test/std/containers/views/span.cons/stdarray.pass.cpp


Index: libcxx/test/std/containers/views/span.cons/stdarray.pass.cpp
===================================================================
--- libcxx/test/std/containers/views/span.cons/stdarray.pass.cpp
+++ libcxx/test/std/containers/views/span.cons/stdarray.pass.cpp
@@ -22,6 +22,7 @@
 
 
 #include <span>
+#include <array>
 #include <cassert>
 #include <string>
 
Index: libcxx/include/span
===================================================================
--- libcxx/include/span
+++ libcxx/include/span
@@ -129,11 +129,9 @@
 */
 
 #include <__config>
-#include <cstddef>      // for ptrdiff_t
+#include <cstddef>      // for byte
 #include <iterator>     // for iterators
-#include <array>        // for array
 #include <type_traits>  // for remove_cv, etc
-#include <cstddef>      // for byte
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -146,6 +144,8 @@
 inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
 template <typename _Tp, size_t _Extent = dynamic_extent> class span;
 
+template <class _Tp, size_t _Sz>
+struct array;
 
 template <class _Tp>
 struct __is_span_impl : public false_type {};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72036.235706.patch
Type: text/x-patch
Size: 1163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191231/fed43bb4/attachment.bin>


More information about the libcxx-commits mailing list