span_compatibility_tests.cpp 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023
  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2015 Microsoft Corporation. All rights reserved.
  4. //
  5. // This code is licensed under the MIT License (MIT).
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  10. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  11. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  12. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  13. // THE SOFTWARE.
  14. //
  15. ///////////////////////////////////////////////////////////////////////////////
  16. #include <gtest/gtest.h>
  17. #include <gsl/byte> // for byte
  18. #include <gsl/span> // for span, span_iterator, operator==, operator!=
  19. #include <array> // for array
  20. #include <cstddef> // for ptrdiff_t
  21. #include <iterator> // for reverse_iterator, operator-, operator==
  22. #include <type_traits> // for integral_constant<>::value, is_default_co...
  23. #include <utility>
  24. #include <vector> // for vector
  25. using namespace std;
  26. using namespace gsl;
  27. // Below are tests that verify the gsl interface support the same things as the std
  28. // Ranges and Concepts support need to be added later.
  29. struct Base
  30. {
  31. };
  32. struct Derived : Base
  33. {
  34. };
  35. static_assert(std::is_convertible<Derived*, Base*>::value, "std::is_convertible<Derived*, Base*>");
  36. static_assert(!std::is_convertible<Derived (*)[], Base (*)[]>::value,
  37. "!std::is_convertible<Derived(*)[], Base(*)[]>");
  38. // int*(*) [], int const* const(*)[] was identified as an issue in CWG330 and the resolution was
  39. // provided with N4261.
  40. template <class T = int>
  41. void ArrayConvertibilityCheck()
  42. {
  43. #if __cplusplus >= 201703l
  44. if constexpr (std::is_convertible<T*(*) [], T const* const(*)[]>::value)
  45. {
  46. std::array<T*, 3> stl_nullptr{{nullptr, nullptr, nullptr}};
  47. gsl::span<const T* const> sp_const_nullptr_1{stl_nullptr};
  48. EXPECT_TRUE(sp_const_nullptr_1.data() == stl_nullptr.data());
  49. EXPECT_TRUE(sp_const_nullptr_1.size() == 3);
  50. gsl::span<const T* const> sp_const_nullptr_2{std::as_const(stl_nullptr)};
  51. EXPECT_TRUE(sp_const_nullptr_2.data() == stl_nullptr.data());
  52. EXPECT_TRUE(sp_const_nullptr_2.size() == 3);
  53. static_assert(std::is_same<decltype(gsl::span{stl_nullptr}), gsl::span<T*, 3>>::value,
  54. "std::is_same< decltype(span{stl_nullptr}), span<T*, 3>>::value");
  55. static_assert(
  56. std::is_same<decltype(gsl::span{std::as_const(stl_nullptr)}), gsl::span<T* const, 3>>::value,
  57. "std::is_same< decltype(span{std::as_const(stl_nullptr)}), span<T* const, "
  58. "3>>::value");
  59. }
  60. #endif
  61. }
  62. TEST(span_compatibility_tests, assertion_tests)
  63. {
  64. int arr[3]{10, 20, 30};
  65. std::array<int, 3> stl{{100, 200, 300}};
  66. ArrayConvertibilityCheck();
  67. {
  68. gsl::span<int> sp_dyn;
  69. EXPECT_TRUE(sp_dyn.data() == nullptr);
  70. EXPECT_TRUE(sp_dyn.size() == 0);
  71. EXPECT_TRUE(sp_dyn.empty());
  72. }
  73. {
  74. gsl::span<int, 0> sp_zero;
  75. EXPECT_TRUE(sp_zero.data() == nullptr);
  76. EXPECT_TRUE(sp_zero.size() == 0);
  77. EXPECT_TRUE(sp_zero.empty());
  78. gsl::span<int> sp_dyn_a(arr, 3);
  79. gsl::span<int> sp_dyn_b(begin(arr), 3);
  80. EXPECT_TRUE(sp_dyn_a.data() == std::begin(arr));
  81. EXPECT_TRUE(sp_dyn_b.data() == std::begin(arr));
  82. EXPECT_TRUE(sp_dyn_a.size() == 3);
  83. EXPECT_TRUE(sp_dyn_b.size() == 3);
  84. gsl::span<int, 3> sp_three_a(arr, 3);
  85. gsl::span<int, 3> sp_three_b(begin(arr), 3);
  86. EXPECT_TRUE(sp_three_a.data() == std::begin(arr));
  87. EXPECT_TRUE(sp_three_b.data() == std::begin(arr));
  88. EXPECT_TRUE(sp_three_a.size() == 3);
  89. EXPECT_TRUE(sp_three_b.size() == 3);
  90. gsl::span<const int> sp_const_a(arr, 3);
  91. gsl::span<const int> sp_const_b(begin(arr), 3);
  92. EXPECT_TRUE(sp_const_a.data() == std::begin(arr));
  93. EXPECT_TRUE(sp_const_b.data() == std::begin(arr));
  94. EXPECT_TRUE(sp_const_a.size() == 3);
  95. EXPECT_TRUE(sp_const_b.size() == 3);
  96. #if __cplusplus >= 201703l
  97. gsl::span<const int> sp_const_c(std::as_const(arr), 3);
  98. EXPECT_TRUE(sp_const_c.data() == std::begin(arr));
  99. EXPECT_TRUE(sp_const_c.size() == 3);
  100. #endif // __cplusplus >= 201703l
  101. gsl::span<const int> sp_const_d(cbegin(arr), 3);
  102. EXPECT_TRUE(sp_const_d.data() == std::begin(arr));
  103. EXPECT_TRUE(sp_const_d.size() == 3);
  104. }
  105. {
  106. gsl::span<int> sp_dyn_a(begin(arr), std::end(arr));
  107. EXPECT_TRUE(sp_dyn_a.data() == std::begin(arr));
  108. EXPECT_TRUE(sp_dyn_a.size() == 3);
  109. gsl::span<int, 3> sp_three_a(begin(arr), std::end(arr));
  110. EXPECT_TRUE(sp_three_a.data() == std::begin(arr));
  111. EXPECT_TRUE(sp_three_a.size() == 3);
  112. gsl::span<const int> sp_const_a(begin(arr), std::end(arr));
  113. gsl::span<const int> sp_const_b(begin(arr), std::cend(arr));
  114. gsl::span<const int> sp_const_c(cbegin(arr), std::end(arr));
  115. gsl::span<const int> sp_const_d(cbegin(arr), std::cend(arr));
  116. EXPECT_TRUE(sp_const_a.data() == std::begin(arr));
  117. EXPECT_TRUE(sp_const_b.data() == std::begin(arr));
  118. EXPECT_TRUE(sp_const_c.data() == std::begin(arr));
  119. EXPECT_TRUE(sp_const_d.data() == std::begin(arr));
  120. EXPECT_TRUE(sp_const_a.size() == 3);
  121. EXPECT_TRUE(sp_const_b.size() == 3);
  122. EXPECT_TRUE(sp_const_c.size() == 3);
  123. EXPECT_TRUE(sp_const_d.size() == 3);
  124. }
  125. {
  126. gsl::span<int> sp_dyn_a(arr);
  127. gsl::span<int> sp_dyn_b(stl);
  128. gsl::span<int> sp_dyn_c{stl};
  129. gsl::span<const int> sp_dyn_d{stl};
  130. EXPECT_TRUE(sp_dyn_a.data() == std::begin(arr));
  131. EXPECT_TRUE(sp_dyn_b.data() == stl.data());
  132. EXPECT_TRUE(sp_dyn_a.size() == 3);
  133. EXPECT_TRUE(sp_dyn_b.size() == 3);
  134. gsl::span<int, 3> sp_three_a(arr);
  135. gsl::span<int, 3> sp_three_b(stl);
  136. EXPECT_TRUE(sp_three_a.data() == std::begin(arr));
  137. EXPECT_TRUE(sp_three_b.data() == stl.data());
  138. EXPECT_TRUE(sp_three_a.size() == 3);
  139. EXPECT_TRUE(sp_three_b.size() == 3);
  140. gsl::span<const int> sp_const_w(arr);
  141. gsl::span<const int> sp_const_y(stl);
  142. EXPECT_TRUE(sp_const_w.data() == std::begin(arr));
  143. EXPECT_TRUE(sp_const_y.data() == stl.data());
  144. EXPECT_TRUE(sp_const_w.size() == 3);
  145. EXPECT_TRUE(sp_const_y.size() == 3);
  146. #if __cplusplus >= 201703l
  147. gsl::span<const int> sp_const_x(std::as_const(arr));
  148. EXPECT_TRUE(sp_const_x.data() == std::begin(arr));
  149. EXPECT_TRUE(sp_const_x.size() == 3);
  150. gsl::span<const int> sp_const_z(std::as_const(stl));
  151. EXPECT_TRUE(sp_const_z.data() == stl.data());
  152. EXPECT_TRUE(sp_const_z.size() == 3);
  153. #endif // __cplusplus >= 201703l
  154. }
  155. {
  156. const gsl::span<int> orig_dyn(arr);
  157. const gsl::span<int, 3> orig_three(arr);
  158. const gsl::span<const int> orig_const_dyn(arr);
  159. const gsl::span<const int, 3> orig_const_three(arr);
  160. gsl::span<int> sp_a(orig_dyn);
  161. gsl::span<int> sp_b(orig_three);
  162. gsl::span<int, 3> sp_c(orig_three);
  163. gsl::span<const int> sp_d(orig_dyn);
  164. gsl::span<const int> sp_e(orig_three);
  165. gsl::span<const int> sp_f(orig_const_dyn);
  166. gsl::span<const int> sp_g(orig_const_three);
  167. gsl::span<const int, 3> sp_h(orig_three);
  168. gsl::span<const int, 3> sp_i(orig_const_three);
  169. EXPECT_TRUE(sp_a.data() == std::begin(arr));
  170. EXPECT_TRUE(sp_b.data() == std::begin(arr));
  171. EXPECT_TRUE(sp_c.data() == std::begin(arr));
  172. EXPECT_TRUE(sp_d.data() == std::begin(arr));
  173. EXPECT_TRUE(sp_e.data() == std::begin(arr));
  174. EXPECT_TRUE(sp_f.data() == std::begin(arr));
  175. EXPECT_TRUE(sp_g.data() == std::begin(arr));
  176. EXPECT_TRUE(sp_h.data() == std::begin(arr));
  177. EXPECT_TRUE(sp_i.data() == std::begin(arr));
  178. EXPECT_TRUE(sp_a.size() == 3);
  179. EXPECT_TRUE(sp_b.size() == 3);
  180. EXPECT_TRUE(sp_c.size() == 3);
  181. EXPECT_TRUE(sp_d.size() == 3);
  182. EXPECT_TRUE(sp_e.size() == 3);
  183. EXPECT_TRUE(sp_f.size() == 3);
  184. EXPECT_TRUE(sp_g.size() == 3);
  185. EXPECT_TRUE(sp_h.size() == 3);
  186. EXPECT_TRUE(sp_i.size() == 3);
  187. }
  188. {
  189. gsl::span<int> sp_dyn(arr);
  190. gsl::span<int, 3> sp_three(arr);
  191. gsl::span<const int> sp_const_dyn(arr);
  192. gsl::span<const int, 3> sp_const_three(arr);
  193. EXPECT_TRUE(sp_dyn.data() == std::begin(arr));
  194. EXPECT_TRUE(sp_three.data() == std::begin(arr));
  195. EXPECT_TRUE(sp_const_dyn.data() == std::begin(arr));
  196. EXPECT_TRUE(sp_const_three.data() == std::begin(arr));
  197. EXPECT_TRUE(sp_dyn.size() == 3);
  198. EXPECT_TRUE(sp_three.size() == 3);
  199. EXPECT_TRUE(sp_const_dyn.size() == 3);
  200. EXPECT_TRUE(sp_const_three.size() == 3);
  201. int other[4]{12, 34, 56, 78};
  202. sp_dyn = gsl::span<int>{other};
  203. sp_three = gsl::span<int, 3>{stl};
  204. sp_const_dyn = gsl::span<const int>{other};
  205. sp_const_three = gsl::span<const int, 3>{stl};
  206. EXPECT_TRUE(sp_dyn.data() == std::begin(other));
  207. EXPECT_TRUE(sp_three.data() == stl.data());
  208. EXPECT_TRUE(sp_const_dyn.data() == std::begin(other));
  209. EXPECT_TRUE(sp_const_three.data() == stl.data());
  210. EXPECT_TRUE(sp_dyn.size() == 4);
  211. EXPECT_TRUE(sp_three.size() == 3);
  212. EXPECT_TRUE(sp_const_dyn.size() == 4);
  213. EXPECT_TRUE(sp_const_three.size() == 3);
  214. }
  215. {
  216. gsl::span<int>::iterator it_dyn{};
  217. {
  218. gsl::span<int> sp_dyn(arr);
  219. it_dyn = sp_dyn.begin();
  220. }
  221. EXPECT_TRUE(*it_dyn == arr[0]);
  222. EXPECT_TRUE(it_dyn[2] == arr[2]);
  223. gsl::span<int, 3>::iterator it_three{};
  224. {
  225. gsl::span<int, 3> sp_three(stl);
  226. it_three = sp_three.begin();
  227. }
  228. EXPECT_TRUE(*it_three == stl[0]);
  229. EXPECT_TRUE(it_three[2] == stl[2]);
  230. }
  231. {
  232. int sequence[9]{10, 20, 30, 40, 50, 60, 70, 80, 90};
  233. const gsl::span<int> sp_dyn(sequence);
  234. const gsl::span<int, 9> sp_nine(sequence);
  235. auto first_3 = sp_dyn.first<3>();
  236. auto first_4 = sp_nine.first<4>();
  237. auto first_5 = sp_dyn.first(5);
  238. auto first_6 = sp_nine.first(6);
  239. static_assert(noexcept(sp_dyn.first<3>()), "noexcept(sp_dyn.first<3>())"); // strengthened
  240. static_assert(noexcept(sp_nine.first<4>()), "noexcept(sp_nine.first<4>())"); // strengthened
  241. static_assert(noexcept(sp_dyn.first(5)), "noexcept(sp_dyn.first(5))"); // strengthened
  242. static_assert(noexcept(sp_nine.first(6)), "noexcept(sp_nine.first(6))"); // strengthened
  243. static_assert(is_same<decltype(first_3), gsl::span<int, 3>>::value,
  244. "is_same<decltype(first_3), gsl::span<int, 3>>::value");
  245. static_assert(is_same<decltype(first_4), gsl::span<int, 4>>::value,
  246. "is_same<decltype(first_4), gsl::span<int, 4>>::value");
  247. static_assert(is_same<decltype(first_5), gsl::span<int>>::value,
  248. "is_same<decltype(first_5), gsl::span<int>>::value");
  249. static_assert(is_same<decltype(first_6), gsl::span<int>>::value,
  250. "is_same<decltype(first_6), gsl::span<int>>::value");
  251. EXPECT_TRUE(first_3.data() == std::begin(sequence));
  252. EXPECT_TRUE(first_4.data() == std::begin(sequence));
  253. EXPECT_TRUE(first_5.data() == std::begin(sequence));
  254. EXPECT_TRUE(first_6.data() == std::begin(sequence));
  255. EXPECT_TRUE(first_3.size() == 3);
  256. EXPECT_TRUE(first_4.size() == 4);
  257. EXPECT_TRUE(first_5.size() == 5);
  258. EXPECT_TRUE(first_6.size() == 6);
  259. auto last_3 = sp_dyn.last<3>();
  260. auto last_4 = sp_nine.last<4>();
  261. auto last_5 = sp_dyn.last(5);
  262. auto last_6 = sp_nine.last(6);
  263. static_assert(noexcept(sp_dyn.last<3>()), "noexcept(sp_dyn.last<3>())"); // strengthened
  264. static_assert(noexcept(sp_nine.last<4>()), "noexcept(sp_nine.last<4>())"); // strengthened
  265. static_assert(noexcept(sp_dyn.last(5)), "noexcept(sp_dyn.last(5))"); // strengthened
  266. static_assert(noexcept(sp_nine.last(6)), "noexcept(sp_nine.last(6))"); // strengthened
  267. static_assert(is_same<decltype(last_3), gsl::span<int, 3>>::value,
  268. "is_same<decltype(last_3), gsl::span<int, 3>>::value");
  269. static_assert(is_same<decltype(last_4), gsl::span<int, 4>>::value,
  270. "is_same<decltype(last_4), gsl::span<int, 4>>::value");
  271. static_assert(is_same<decltype(last_5), gsl::span<int>>::value,
  272. "is_same<decltype(last_5), gsl::span<int>>::value");
  273. static_assert(is_same<decltype(last_6), gsl::span<int>>::value,
  274. "is_same<decltype(last_6), gsl::span<int>>::value");
  275. EXPECT_TRUE(last_3.data() == std::begin(sequence) + 6);
  276. EXPECT_TRUE(last_4.data() == std::begin(sequence) + 5);
  277. EXPECT_TRUE(last_5.data() == std::begin(sequence) + 4);
  278. EXPECT_TRUE(last_6.data() == std::begin(sequence) + 3);
  279. EXPECT_TRUE(last_3.size() == 3);
  280. EXPECT_TRUE(last_4.size() == 4);
  281. EXPECT_TRUE(last_5.size() == 5);
  282. EXPECT_TRUE(last_6.size() == 6);
  283. auto offset_3 = sp_dyn.subspan<3>();
  284. auto offset_4 = sp_nine.subspan<4>();
  285. auto offset_5 = sp_dyn.subspan(5);
  286. auto offset_6 = sp_nine.subspan(6);
  287. static_assert(noexcept(sp_dyn.subspan<3>()),
  288. "noexcept(sp_dyn.subspan<3>())"); // strengthened
  289. static_assert(noexcept(sp_nine.subspan<4>()),
  290. "noexcept(sp_nine.subspan<4>())"); // strengthened
  291. static_assert(noexcept(sp_dyn.subspan(5)), "noexcept(sp_dyn.subspan(5))"); // strengthened
  292. static_assert(noexcept(sp_nine.subspan(6)), "noexcept(sp_nine.subspan(6))"); // strengthened
  293. static_assert(is_same<decltype(offset_3), gsl::span<int>>::value,
  294. "is_same<decltype(offset_3), gsl::span<int>>::value");
  295. static_assert(is_same<decltype(offset_4), gsl::span<int, 5>>::value,
  296. "is_same<decltype(offset_4), gsl::span<int, 5>>::value");
  297. static_assert(is_same<decltype(offset_5), gsl::span<int>>::value,
  298. "is_same<decltype(offset_5), gsl::span<int>>::value");
  299. static_assert(is_same<decltype(offset_6), gsl::span<int>>::value,
  300. "is_same<decltype(offset_6), gsl::span<int>>::value");
  301. EXPECT_TRUE(offset_3.data() == std::begin(sequence) + 3);
  302. EXPECT_TRUE(offset_4.data() == std::begin(sequence) + 4);
  303. EXPECT_TRUE(offset_5.data() == std::begin(sequence) + 5);
  304. EXPECT_TRUE(offset_6.data() == std::begin(sequence) + 6);
  305. EXPECT_TRUE(offset_3.size() == 6);
  306. EXPECT_TRUE(offset_4.size() == 5);
  307. EXPECT_TRUE(offset_5.size() == 4);
  308. EXPECT_TRUE(offset_6.size() == 3);
  309. auto subspan_3 = sp_dyn.subspan<3, 2>();
  310. auto subspan_4 = sp_nine.subspan<4, 2>();
  311. auto subspan_5 = sp_dyn.subspan(5, 2);
  312. auto subspan_6 = sp_nine.subspan(6, 2);
  313. static_assert(noexcept(sp_dyn.subspan<3, 2>()),
  314. "noexcept(sp_dyn.subspan<3, 2>())"); // strengthened
  315. static_assert(noexcept(sp_nine.subspan<4, 2>()),
  316. "noexcept(sp_nine.subspan<4, 2>())"); // strengthened
  317. static_assert(noexcept(sp_dyn.subspan(5, 2)),
  318. "noexcept(sp_dyn.subspan(5, 2))"); // strengthened
  319. static_assert(noexcept(sp_nine.subspan(6, 2)),
  320. "noexcept(sp_nine.subspan(6, 2))"); // strengthened
  321. static_assert(is_same<decltype(subspan_3), gsl::span<int, 2>>::value,
  322. "is_same<decltype(subspan_3), gsl::span<int, 2>>::value");
  323. static_assert(is_same<decltype(subspan_4), gsl::span<int, 2>>::value,
  324. "is_same<decltype(subspan_4), gsl::span<int, 2>>::value");
  325. static_assert(is_same<decltype(subspan_5), gsl::span<int>>::value,
  326. "is_same<decltype(subspan_5), gsl::span<int>>::value");
  327. static_assert(is_same<decltype(subspan_6), gsl::span<int>>::value,
  328. "is_same<decltype(subspan_6), gsl::span<int>>::value");
  329. EXPECT_TRUE(subspan_3.data() == std::begin(sequence) + 3);
  330. EXPECT_TRUE(subspan_4.data() == std::begin(sequence) + 4);
  331. EXPECT_TRUE(subspan_5.data() == std::begin(sequence) + 5);
  332. EXPECT_TRUE(subspan_6.data() == std::begin(sequence) + 6);
  333. EXPECT_TRUE(subspan_3.size() == 2);
  334. EXPECT_TRUE(subspan_4.size() == 2);
  335. EXPECT_TRUE(subspan_5.size() == 2);
  336. EXPECT_TRUE(subspan_6.size() == 2);
  337. static_assert(noexcept(sp_dyn.size()), "noexcept(sp_dyn.size())");
  338. static_assert(noexcept(sp_dyn.size_bytes()), "noexcept(sp_dyn.size_bytes())");
  339. static_assert(noexcept(sp_dyn.empty()), "noexcept(sp_dyn.empty())");
  340. static_assert(noexcept(sp_dyn[0]), "noexcept(sp_dyn[0])"); // strengthened
  341. static_assert(noexcept(sp_dyn.front()), "noexcept(sp_dyn.front())"); // strengthened
  342. static_assert(noexcept(sp_dyn.back()), "noexcept(sp_dyn.back())"); // strengthened
  343. static_assert(noexcept(sp_dyn.data()), "noexcept(sp_dyn.data())");
  344. static_assert(noexcept(sp_dyn.begin()), "noexcept(sp_dyn.begin())");
  345. static_assert(noexcept(sp_dyn.end()), "noexcept(sp_dyn.end())");
  346. static_assert(noexcept(sp_dyn.rbegin()), "noexcept(sp_dyn.rbegin())");
  347. static_assert(noexcept(sp_dyn.rend()), "noexcept(sp_dyn.rend())");
  348. static_assert(noexcept(sp_nine.size()), "noexcept(sp_nine.size())");
  349. static_assert(noexcept(sp_nine.size_bytes()), "noexcept(sp_nine.size_bytes())");
  350. static_assert(noexcept(sp_nine.empty()), "noexcept(sp_nine.empty())");
  351. static_assert(noexcept(sp_nine[0]), "noexcept(sp_nine[0])"); // strengthened
  352. static_assert(noexcept(sp_nine.front()), "noexcept(sp_nine.front())"); // strengthened
  353. static_assert(noexcept(sp_nine.back()), "noexcept(sp_nine.back())"); // strengthened
  354. static_assert(noexcept(sp_nine.data()), "noexcept(sp_nine.data())");
  355. static_assert(noexcept(sp_nine.begin()), "noexcept(sp_nine.begin())");
  356. static_assert(noexcept(sp_nine.end()), "noexcept(sp_nine.end())");
  357. static_assert(noexcept(sp_nine.rbegin()), "noexcept(sp_nine.rbegin())");
  358. static_assert(noexcept(sp_nine.rend()), "noexcept(sp_nine.rend())");
  359. EXPECT_TRUE(sp_dyn.size() == 9);
  360. EXPECT_TRUE(sp_nine.size() == 9);
  361. EXPECT_TRUE(sp_dyn.size_bytes() == 9 * sizeof(int));
  362. EXPECT_TRUE(sp_nine.size_bytes() == 9 * sizeof(int));
  363. EXPECT_TRUE(!sp_dyn.empty());
  364. EXPECT_TRUE(!sp_nine.empty());
  365. EXPECT_TRUE(sp_dyn[0] == 10);
  366. EXPECT_TRUE(sp_nine[0] == 10);
  367. EXPECT_TRUE(sp_dyn[8] == 90);
  368. EXPECT_TRUE(sp_nine[8] == 90);
  369. EXPECT_TRUE(sp_dyn.front() == 10);
  370. EXPECT_TRUE(sp_nine.front() == 10);
  371. EXPECT_TRUE(sp_dyn.back() == 90);
  372. EXPECT_TRUE(sp_nine.back() == 90);
  373. EXPECT_TRUE(&sp_dyn.front() == std::begin(sequence));
  374. EXPECT_TRUE(&sp_nine.front() == std::begin(sequence));
  375. EXPECT_TRUE(&sp_dyn[4] == std::begin(sequence) + 4);
  376. EXPECT_TRUE(&sp_nine[4] == std::begin(sequence) + 4);
  377. EXPECT_TRUE(&sp_dyn.back() == std::begin(sequence) + 8);
  378. EXPECT_TRUE(&sp_nine.back() == std::begin(sequence) + 8);
  379. EXPECT_TRUE(sp_dyn.data() == std::begin(sequence));
  380. EXPECT_TRUE(sp_nine.data() == std::begin(sequence));
  381. EXPECT_TRUE(*sp_dyn.begin() == 10);
  382. EXPECT_TRUE(*sp_nine.begin() == 10);
  383. EXPECT_TRUE(sp_dyn.end()[-2] == 80);
  384. EXPECT_TRUE(sp_nine.end()[-2] == 80);
  385. EXPECT_TRUE(*sp_dyn.rbegin() == 90);
  386. EXPECT_TRUE(*sp_nine.rbegin() == 90);
  387. EXPECT_TRUE(sp_dyn.rend()[-2] == 20);
  388. EXPECT_TRUE(sp_nine.rend()[-2] == 20);
  389. static_assert(is_same<decltype(sp_dyn.begin()), gsl::span<int>::iterator>::value,
  390. "is_same<decltype(sp_dyn.begin()), gsl::span<int>::iterator>::value");
  391. static_assert(is_same<decltype(sp_nine.begin()), gsl::span<int, 9>::iterator>::value,
  392. "is_same<decltype(sp_nine.begin()), gsl::span<int, 9>::iterator>::value");
  393. static_assert(is_same<decltype(sp_dyn.end()), gsl::span<int>::iterator>::value,
  394. "is_same<decltype(sp_dyn.end()), gsl::span<int>::iterator>::value");
  395. static_assert(is_same<decltype(sp_nine.end()), gsl::span<int, 9>::iterator>::value,
  396. "is_same<decltype(sp_nine.end()), gsl::span<int, 9>::iterator>::value");
  397. static_assert(
  398. is_same<decltype(sp_dyn.rbegin()), gsl::span<int>::reverse_iterator>::value,
  399. "is_same<decltype(sp_dyn.rbegin()), gsl::span<int>::reverse_iterator>::value");
  400. static_assert(
  401. is_same<decltype(sp_nine.rbegin()), gsl::span<int, 9>::reverse_iterator>::value,
  402. "is_same<decltype(sp_nine.rbegin()), gsl::span<int, 9>::reverse_iterator>::value");
  403. static_assert(is_same<decltype(sp_dyn.rend()), gsl::span<int>::reverse_iterator>::value,
  404. "is_same<decltype(sp_dyn.rend()), gsl::span<int>::reverse_iterator>::value");
  405. static_assert(
  406. is_same<decltype(sp_nine.rend()), gsl::span<int, 9>::reverse_iterator>::value,
  407. "is_same<decltype(sp_nine.rend()), gsl::span<int, 9>::reverse_iterator>::value");
  408. }
  409. {
  410. int sequence[9]{10, 20, 30, 40, 50, 60, 70, 80, 90};
  411. constexpr size_t SizeBytes = sizeof(sequence);
  412. const gsl::span<int> sp_dyn(sequence);
  413. const gsl::span<int, 9> sp_nine(sequence);
  414. const gsl::span<const int> sp_const_dyn(sequence);
  415. const gsl::span<const int, 9> sp_const_nine(sequence);
  416. static_assert(noexcept(as_bytes(sp_dyn)), "noexcept(as_bytes(sp_dyn))");
  417. static_assert(noexcept(as_bytes(sp_nine)), "noexcept(as_bytes(sp_nine))");
  418. static_assert(noexcept(as_bytes(sp_const_dyn)), "noexcept(as_bytes(sp_const_dyn))");
  419. static_assert(noexcept(as_bytes(sp_const_nine)), "noexcept(as_bytes(sp_const_nine))");
  420. static_assert(noexcept(as_writable_bytes(sp_dyn)), "noexcept(as_writable_bytes(sp_dyn))");
  421. static_assert(noexcept(as_writable_bytes(sp_nine)), "noexcept(as_writable_bytes(sp_nine))");
  422. auto sp_1 = as_bytes(sp_dyn);
  423. auto sp_2 = as_bytes(sp_nine);
  424. auto sp_3 = as_bytes(sp_const_dyn);
  425. auto sp_4 = as_bytes(sp_const_nine);
  426. auto sp_5 = as_writable_bytes(sp_dyn);
  427. auto sp_6 = as_writable_bytes(sp_nine);
  428. static_assert(is_same<decltype(sp_1), gsl::span<const byte>>::value,
  429. "is_same<decltype(sp_1), gsl::span<const byte>>::value");
  430. static_assert(is_same<decltype(sp_2), gsl::span<const byte, SizeBytes>>::value,
  431. "is_same<decltype(sp_2), gsl::span<const byte, SizeBytes>>::value");
  432. static_assert(is_same<decltype(sp_3), gsl::span<const byte>>::value,
  433. "is_same<decltype(sp_3), gsl::span<const byte>>::value");
  434. static_assert(is_same<decltype(sp_4), gsl::span<const byte, SizeBytes>>::value,
  435. "is_same<decltype(sp_4), gsl::span<const byte, SizeBytes>>::value");
  436. static_assert(is_same<decltype(sp_5), gsl::span<byte>>::value,
  437. "is_same<decltype(sp_5), gsl::span<byte>>::value");
  438. static_assert(is_same<decltype(sp_6), gsl::span<byte, SizeBytes>>::value,
  439. "is_same<decltype(sp_6), gsl::span<byte, SizeBytes>>::value");
  440. EXPECT_TRUE(sp_1.data() == reinterpret_cast<const byte*>(begin(sequence)));
  441. EXPECT_TRUE(sp_2.data() == reinterpret_cast<const byte*>(begin(sequence)));
  442. EXPECT_TRUE(sp_3.data() == reinterpret_cast<const byte*>(begin(sequence)));
  443. EXPECT_TRUE(sp_4.data() == reinterpret_cast<const byte*>(begin(sequence)));
  444. EXPECT_TRUE(sp_5.data() == reinterpret_cast<byte*>(begin(sequence)));
  445. EXPECT_TRUE(sp_6.data() == reinterpret_cast<byte*>(begin(sequence)));
  446. EXPECT_TRUE(sp_1.size() == SizeBytes);
  447. EXPECT_TRUE(sp_2.size() == SizeBytes);
  448. EXPECT_TRUE(sp_3.size() == SizeBytes);
  449. EXPECT_TRUE(sp_4.size() == SizeBytes);
  450. EXPECT_TRUE(sp_5.size() == SizeBytes);
  451. EXPECT_TRUE(sp_6.size() == SizeBytes);
  452. }
  453. }
  454. // assertions for span's definition
  455. static_assert(std::is_same<decltype(gsl::dynamic_extent), const std::size_t>::value,
  456. "gsl::dynamic_extent must be represented as std::size_t");
  457. static_assert(gsl::dynamic_extent == static_cast<std::size_t>(-1),
  458. "gsl::dynamic_extent must be defined as the max value of std::size_t");
  459. static_assert(std::is_same<decltype(gsl::span<int>::extent), const std::size_t>::value,
  460. "Ensure that the type of gsl::span::extent is std::size_t");
  461. static_assert(gsl::span<int>::extent == gsl::dynamic_extent,
  462. "gsl::span<int>::extent should be equivalent to gsl::dynamic_extent");
  463. static_assert(std::is_same<decltype(gsl::span<int, 3>::extent), const std::size_t>::value,
  464. "Ensure that the type of gsl::span::extent is std::size_t");
  465. static_assert(gsl::span<int, 3>::extent == 3, "Ensure that span<int, 3>::extent is equal to 3");
  466. static_assert(std::is_same<gsl::span<int>::element_type, int>::value,
  467. "span<int>::element_type should be int");
  468. static_assert(std::is_same<gsl::span<int>::value_type, int>::value,
  469. "span<int>::value_type should be int");
  470. static_assert(std::is_same<gsl::span<int>::size_type, std::size_t>::value,
  471. "span<int>::size_type should be std::size_t");
  472. static_assert(std::is_same<gsl::span<int>::difference_type, ptrdiff_t>::value,
  473. "span<int>::difference_type should be std::ptrdiff_t");
  474. static_assert(std::is_same<gsl::span<int>::pointer, int*>::value,
  475. "span<int>::pointer should be int*");
  476. static_assert(std::is_same<gsl::span<int>::const_pointer, const int*>::value,
  477. "span<int>::const_pointer should be const int*");
  478. static_assert(std::is_same<gsl::span<int>::reference, int&>::value,
  479. "span<int>::reference should be int&");
  480. static_assert(std::is_same<gsl::span<int>::const_reference, const int&>::value,
  481. "span<int>::const_reference should be const int&");
  482. static_assert(std::is_same<gsl::span<int, 3>::element_type, int>::value,
  483. "span<int, 3>::element_type should be int");
  484. static_assert(std::is_same<gsl::span<int, 3>::value_type, int>::value,
  485. "span<int, 3>::value_type should be int");
  486. static_assert(std::is_same<gsl::span<int, 3>::size_type, std::size_t>::value,
  487. "span<int, 3>::size_type should be std::size_t");
  488. static_assert(std::is_same<gsl::span<int, 3>::difference_type, ptrdiff_t>::value,
  489. "span<int, 3>::difference_type should be std::ptrdiff_t");
  490. static_assert(std::is_same<gsl::span<int, 3>::pointer, int*>::value,
  491. "span<int, 3>::pointer should be int*");
  492. static_assert(std::is_same<gsl::span<int, 3>::const_pointer, const int*>::value,
  493. "span<int, 3>::const_pointer should be const int*");
  494. static_assert(std::is_same<gsl::span<int, 3>::reference, int&>::value,
  495. "span<int, 3>::reference should be int&");
  496. static_assert(std::is_same<gsl::span<int, 3>::const_reference, const int&>::value,
  497. "span<int, 3>::const_reference should be const int&");
  498. static_assert(std::is_same<gsl::span<const int>::element_type, const int>::value,
  499. "span<const int>::element_type should be const int");
  500. static_assert(std::is_same<gsl::span<const int>::value_type, int>::value,
  501. "span<const int>::value_type should be int");
  502. static_assert(std::is_same<gsl::span<const int>::size_type, std::size_t>::value,
  503. "span<const int>::size_type should be size_t");
  504. static_assert(std::is_same<gsl::span<const int>::difference_type, ptrdiff_t>::value,
  505. "span<const int>::difference_type should be ptrdiff_t");
  506. static_assert(std::is_same<gsl::span<const int>::pointer, const int*>::value,
  507. "span<const int>::pointer should be const int*");
  508. static_assert(std::is_same<gsl::span<const int>::const_pointer, const int*>::value,
  509. "span<const int>::const_pointer should be const int*");
  510. static_assert(std::is_same<gsl::span<const int>::reference, const int&>::value,
  511. "span<const int>::reference should be const int&");
  512. static_assert(std::is_same<gsl::span<const int>::const_reference, const int&>::value,
  513. "span<const int>::const_reference should be const int&");
  514. static_assert(std::is_same<gsl::span<const int, 3>::element_type, const int>::value,
  515. "span<const int, 3>::element_type should be const int");
  516. static_assert(std::is_same<gsl::span<const int, 3>::value_type, int>::value,
  517. "span<const int, 3>::value_type should be int");
  518. static_assert(std::is_same<gsl::span<const int, 3>::size_type, std::size_t>::value,
  519. "span<const int, 3>::size_type should be size_t");
  520. static_assert(std::is_same<gsl::span<const int, 3>::difference_type, ptrdiff_t>::value,
  521. "span<const int, 3>::difference_type should be ptrdiff_t");
  522. static_assert(std::is_same<gsl::span<const int, 3>::pointer, const int*>::value,
  523. "span<const int, 3>::pointer should be const int*");
  524. static_assert(std::is_same<gsl::span<const int, 3>::const_pointer, const int*>::value,
  525. "span<const int, 3>::const_pointer should be const int*");
  526. static_assert(std::is_same<gsl::span<const int, 3>::reference, const int&>::value,
  527. "span<const int, 3>::reference should be const int&");
  528. static_assert(std::is_same<gsl::span<const int, 3>::const_reference, const int&>::value,
  529. "span<const int, 3>::const_reference should be const int&");
  530. // assertions for span_iterator
  531. static_assert(std::is_same<std::iterator_traits<gsl::span<int>::iterator>::pointer, int*>::value,
  532. "span<int>::iterator's pointer should be int*");
  533. static_assert(
  534. std::is_same<gsl::span<int>::reverse_iterator,
  535. std::reverse_iterator<gsl::span<int>::iterator>>::value,
  536. "span<int>::reverse_iterator should equal std::reverse_iterator<span<int>::iterator>");
  537. static_assert(std::is_same<std::iterator_traits<gsl::span<int, 3>::iterator>::pointer, int*>::value,
  538. "span<int, 3>::iterator's pointer should be int*");
  539. static_assert(
  540. std::is_same<gsl::span<int, 3>::reverse_iterator,
  541. std::reverse_iterator<gsl::span<int, 3>::iterator>>::value,
  542. "span<int, 3>::reverse_iterator should equal std::reverse_iterator<span<int, 3>::iterator>");
  543. static_assert(
  544. std::is_same<std::iterator_traits<gsl::span<const int>::iterator>::pointer, const int*>::value,
  545. "span<const int>::iterator's pointer should be int*");
  546. static_assert(std::is_same<gsl::span<const int>::reverse_iterator,
  547. std::reverse_iterator<gsl::span<const int>::iterator>>::value,
  548. "span<const int>::reverse_iterator should equal std::reverse_iterator<span<const "
  549. "int>::iterator>");
  550. static_assert(std::is_same<std::iterator_traits<gsl::span<const int, 3>::iterator>::pointer,
  551. const int*>::value,
  552. "span<const int, 3>::iterator's pointer should be int*");
  553. static_assert(std::is_same<gsl::span<const int, 3>::reverse_iterator,
  554. std::reverse_iterator<gsl::span<const int, 3>::iterator>>::value,
  555. "span<const int, 3>::reverse_iterator should equal std::reverse_iterator<span<const "
  556. "int, 3>::iterator>");
  557. // copyability assertions
  558. static_assert(std::is_trivially_copyable<gsl::span<int>>::value,
  559. "span<int> should be trivially copyable");
  560. static_assert(std::is_trivially_copyable<gsl::span<int>::iterator>::value,
  561. "span<int>::iterator should be trivially copyable");
  562. static_assert(std::is_trivially_copyable<gsl::span<int, 3>>::value,
  563. "span<int, 3> should be trivially copyable");
  564. static_assert(std::is_trivially_copyable<gsl::span<int, 3>::iterator>::value,
  565. "span<int, 3>::iterator should be trivially copyable");
  566. static_assert(std::is_trivially_copyable<gsl::span<const int>>::value,
  567. "span<const int> should be trivially copyable");
  568. static_assert(std::is_trivially_copyable<gsl::span<const int>::iterator>::value,
  569. "span<const int>::iterator should be trivially copyable");
  570. static_assert(std::is_trivially_copyable<gsl::span<const int, 3>>::value,
  571. "span<const int, 3> should be trivially copyable");
  572. static_assert(std::is_trivially_copyable<gsl::span<const int, 3>::iterator>::value,
  573. "span<const int, 3>::iterator should be trivially copyable");
  574. // nothrow constructible assertions
  575. static_assert(std::is_nothrow_constructible<gsl::span<int>, int*, std::size_t>::value,
  576. "std::is_nothrow_constructible<gsl::span<int>, int*, std::size_t>");
  577. static_assert(std::is_nothrow_constructible<gsl::span<int>, int*, std::uint16_t>::value,
  578. "std::is_nothrow_constructible<gsl::span<int>, int*, std::uint16_t>");
  579. static_assert(std::is_nothrow_constructible<gsl::span<int>, int*, int*>::value,
  580. "std::is_nothrow_constructible<gsl::span<int>, int*, int*>");
  581. static_assert(std::is_nothrow_constructible<gsl::span<int>, int (&)[3]>::value,
  582. "std::is_nothrow_constructible<gsl::span<int>, int(&)[3]>");
  583. static_assert(std::is_nothrow_constructible<gsl::span<int>, const gsl::span<int>&>::value,
  584. "std::is_nothrow_constructible<gsl::span<int>, const gsl::span<int>&>");
  585. static_assert(std::is_nothrow_constructible<gsl::span<int>, const gsl::span<int, 3>&>::value,
  586. "std::is_nothrow_constructible<gsl::span<int>, const gsl::span<int, 3>&>");
  587. static_assert(std::is_nothrow_constructible<gsl::span<int>, const gsl::span<int, 500>&>::value,
  588. "std::is_nothrow_constructible<gsl::span<int>, const gsl::span<int, 500>&>");
  589. static_assert(std::is_nothrow_constructible<gsl::span<int>, std::array<int, 3>&>::value,
  590. "std::is_nothrow_constructible<gsl::span<int>, std::array<int, 3>&>");
  591. static_assert(std::is_nothrow_constructible<gsl::span<int, 3>, int*, std::size_t>::value,
  592. "std::is_nothrow_constructible<gsl::span<int, 3>, int*, std::size_t>");
  593. static_assert(std::is_nothrow_constructible<gsl::span<int, 3>, int*, std::uint16_t>::value,
  594. "std::is_nothrow_constructible<gsl::span<int, 3>, int*, std::uint16_t>");
  595. static_assert(std::is_nothrow_constructible<gsl::span<int, 3>, int*, int*>::value,
  596. "std::is_nothrow_constructible<gsl::span<int, 3>, int*, int*>");
  597. static_assert(std::is_nothrow_constructible<gsl::span<int, 3>, int (&)[3]>::value,
  598. "std::is_nothrow_constructible<gsl::span<int, 3>, int(&)[3]>");
  599. static_assert(std::is_nothrow_constructible<gsl::span<int, 3>, const gsl::span<int, 3>&>::value,
  600. "std::is_nothrow_constructible<gsl::span<int, 3>, const gsl::span<int, 3>&>");
  601. static_assert(std::is_nothrow_constructible<gsl::span<int, 3>, std::array<int, 3>&>::value,
  602. "std::is_nothrow_constructible<gsl::span<int, 3>, std::array<int, 3>&>");
  603. static_assert(std::is_nothrow_constructible<gsl::span<const int>, int*, std::size_t>::value,
  604. "std::is_nothrow_constructible<gsl::span<const int>, int*, std::size_t>");
  605. static_assert(std::is_nothrow_constructible<gsl::span<const int>, int*, int*>::value,
  606. "std::is_nothrow_constructible<gsl::span<const int>, int*, int*>");
  607. static_assert(std::is_nothrow_constructible<gsl::span<const int>, int*, const int*>::value,
  608. "std::is_nothrow_constructible<gsl::span<const int>, int*, const int*>");
  609. static_assert(std::is_nothrow_constructible<gsl::span<const int>, int (&)[3]>::value,
  610. "std::is_nothrow_constructible<gsl::span<const int>, int(&)[3]>");
  611. static_assert(std::is_nothrow_constructible<gsl::span<const int>, const int*, int*>::value,
  612. "std::is_nothrow_constructible<gsl::span<const int>, const int*, int*>");
  613. static_assert(std::is_nothrow_constructible<gsl::span<const int>, const int*, const int*>::value,
  614. "std::is_nothrow_constructible<gsl::span<const int>, const int*, const int*>");
  615. static_assert(std::is_nothrow_constructible<gsl::span<const int>, const int*, std::size_t>::value,
  616. "std::is_nothrow_constructible<gsl::span<const int>, const int*, std::size_t>");
  617. static_assert(std::is_nothrow_constructible<gsl::span<const int>, const int (&)[3]>::value,
  618. "std::is_nothrow_constructible<gsl::span<const int>, const int(&)[3]>");
  619. static_assert(std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<int>&>::value,
  620. "std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<int>&>");
  621. static_assert(std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<int, 3>&>::value,
  622. "std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<int, 3>&>");
  623. static_assert(
  624. std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<int, 500>&>::value,
  625. "std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<int, 500>&>");
  626. static_assert(
  627. std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<const int>&>::value,
  628. "std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<const int>&>");
  629. static_assert(
  630. std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<const int, 3>&>::value,
  631. "std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<const int, 3>&>");
  632. static_assert(
  633. std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<const int, 500>&>::value,
  634. "std::is_nothrow_constructible<gsl::span<const int>, const gsl::span<const int, 500>&>");
  635. static_assert(std::is_nothrow_constructible<gsl::span<const int>, std::array<int, 3>&>::value,
  636. "std::is_nothrow_constructible<gsl::span<const int>, std::array<int, 3>&>");
  637. static_assert(std::is_nothrow_constructible<gsl::span<const int>, const std::array<int, 3>&>::value,
  638. "std::is_nothrow_constructible<gsl::span<const int>, const std::array<int, 3>&>");
  639. static_assert(
  640. std::is_nothrow_constructible<gsl::span<const int, 3>, const gsl::span<int, 3>&>::value,
  641. "std::is_nothrow_constructible<gsl::span<const int, 3>, const gsl::span<int, 3>&>");
  642. static_assert(
  643. std::is_nothrow_constructible<gsl::span<const int, 3>, const gsl::span<const int, 3>&>::value,
  644. "std::is_nothrow_constructible<gsl::span<const int, 3>, const gsl::span<const int, 3>&>");
  645. static_assert(std::is_nothrow_constructible<gsl::span<Base>, Base (&)[3]>::value,
  646. "std::is_nothrow_constructible<gsl::span<Base>, Base(&)[3]>");
  647. static_assert(std::is_nothrow_constructible<gsl::span<Base>, const gsl::span<Base>&>::value,
  648. "std::is_nothrow_constructible<gsl::span<Base>, const gsl::span<Base>&>");
  649. static_assert(std::is_nothrow_constructible<gsl::span<Base>, const gsl::span<Base, 3>&>::value,
  650. "std::is_nothrow_constructible<gsl::span<Base>, const gsl::span<Base, 3>&>");
  651. static_assert(std::is_nothrow_constructible<gsl::span<Base>, std::array<Base, 3>&>::value,
  652. "std::is_nothrow_constructible<gsl::span<Base>, std::array<Base, 3>&>");
  653. static_assert(std::is_nothrow_constructible<gsl::span<Base, 3>, Base (&)[3]>::value,
  654. "std::is_nothrow_constructible<gsl::span<Base, 3>, Base(&)[3]>");
  655. static_assert(std::is_nothrow_constructible<gsl::span<Base, 3>, const gsl::span<Base, 3>&>::value,
  656. "std::is_nothrow_constructible<gsl::span<Base, 3>, const gsl::span<Base, 3>&>");
  657. static_assert(std::is_nothrow_constructible<gsl::span<Base, 3>, std::array<Base, 3>&>::value,
  658. "std::is_nothrow_constructible<gsl::span<Base, 3>, std::array<Base, 3>&>");
  659. static_assert(std::is_nothrow_constructible<gsl::span<const Base>, Base (&)[3]>::value,
  660. "std::is_nothrow_constructible<gsl::span<const Base>, Base(&)[3]>");
  661. static_assert(std::is_nothrow_constructible<gsl::span<const Base>, const Base (&)[3]>::value,
  662. "std::is_nothrow_constructible<gsl::span<const Base>, const Base(&)[3]>");
  663. static_assert(std::is_nothrow_constructible<gsl::span<const Base>, const gsl::span<Base>&>::value,
  664. "std::is_nothrow_constructible<gsl::span<const Base>, const gsl::span<Base>&>");
  665. static_assert(
  666. std::is_nothrow_constructible<gsl::span<const Base>, const gsl::span<Base, 3>&>::value,
  667. "std::is_nothrow_constructible<gsl::span<const Base>, const gsl::span<Base, 3>&>");
  668. static_assert(
  669. std::is_nothrow_constructible<gsl::span<const Base>, const gsl::span<const Base>&>::value,
  670. "std::is_nothrow_constructible<gsl::span<const Base>, const gsl::span<const Base>&>");
  671. static_assert(
  672. std::is_nothrow_constructible<gsl::span<const Base>, const gsl::span<const Base, 3>&>::value,
  673. "std::is_nothrow_constructible<gsl::span<const Base>, const gsl::span<const Base, 3>&>");
  674. static_assert(std::is_nothrow_constructible<gsl::span<const Base>, std::array<Base, 3>&>::value,
  675. "std::is_nothrow_constructible<gsl::span<const Base>, std::array<Base, 3>&>");
  676. static_assert(
  677. std::is_nothrow_constructible<gsl::span<const Base>, const std::array<Base, 3>&>::value,
  678. "std::is_nothrow_constructible<gsl::span<const Base>, const std::array<Base, 3>&>");
  679. static_assert(
  680. std::is_nothrow_constructible<gsl::span<const Base, 3>, const gsl::span<Base, 3>&>::value,
  681. "std::is_nothrow_constructible<gsl::span<const Base, 3>, const gsl::span<Base, 3>&>");
  682. static_assert(
  683. std::is_nothrow_constructible<gsl::span<const Base, 3>, const gsl::span<const Base, 3>&>::value,
  684. "std::is_nothrow_constructible<gsl::span<const Base, 3>, const gsl::span<const Base, 3>&>");
  685. // non-constructible assertions
  686. static_assert(!std::is_constructible<gsl::span<int>, const int*, int*>::value,
  687. "!std::is_constructible<gsl::span<int>, const int*, int*>");
  688. static_assert(!std::is_constructible<gsl::span<int>, const int*, const int*>::value,
  689. "!std::is_constructible<gsl::span<int>, const int*, const int*>");
  690. static_assert(!std::is_constructible<gsl::span<int>, const int*, double*>::value,
  691. "!std::is_constructible<gsl::span<int>, const int*, double*>");
  692. static_assert(!std::is_constructible<gsl::span<int>, const int*, std::size_t>::value,
  693. "!std::is_constructible<gsl::span<int>, const int*, std::size_t>");
  694. static_assert(!std::is_constructible<gsl::span<int>, const int (&)[3]>::value,
  695. "!std::is_constructible<gsl::span<int>, const int(&)[3]>");
  696. static_assert(!std::is_constructible<gsl::span<int>, double*, int*>::value,
  697. "!std::is_constructible<gsl::span<int>, double*, int*>");
  698. static_assert(!std::is_constructible<gsl::span<int>, double*, const int*>::value,
  699. "!std::is_constructible<gsl::span<int>, double*, const int*>");
  700. static_assert(!std::is_constructible<gsl::span<int>, double*, double*>::value,
  701. "!std::is_constructible<gsl::span<int>, double*, double*>");
  702. static_assert(!std::is_constructible<gsl::span<int>, double*, std::size_t>::value,
  703. "!std::is_constructible<gsl::span<int>, double*, std::size_t>");
  704. static_assert(!std::is_constructible<gsl::span<int>, double (&)[3]>::value,
  705. "!std::is_constructible<gsl::span<int>, double(&)[3]>");
  706. static_assert(!std::is_constructible<gsl::span<int>, int*, double*>::value,
  707. "!std::is_constructible<gsl::span<int>, int*, double*>");
  708. static_assert(!std::is_constructible<gsl::span<int>, std::size_t, int*>::value,
  709. "!std::is_constructible<gsl::span<int>, std::size_t, int*>");
  710. static_assert(!std::is_constructible<gsl::span<int>, std::size_t, std::size_t>::value,
  711. "!std::is_constructible<gsl::span<int>, std::size_t, std::size_t>");
  712. static_assert(!std::is_constructible<gsl::span<int>, const gsl::span<const int>&>::value,
  713. "!std::is_constructible<gsl::span<int>, const gsl::span<const int>&>");
  714. static_assert(!std::is_constructible<gsl::span<int>, const gsl::span<const int, 3>&>::value,
  715. "!std::is_constructible<gsl::span<int>, const gsl::span<const int, 3>&>");
  716. static_assert(!std::is_constructible<gsl::span<int>, const gsl::span<const int, 500>&>::value,
  717. "!std::is_constructible<gsl::span<int>, const gsl::span<const int, 500>&>");
  718. static_assert(!std::is_constructible<gsl::span<int>, const gsl::span<double, 3>&>::value,
  719. "!std::is_constructible<gsl::span<int>, const gsl::span<double, 3>&>");
  720. static_assert(!std::is_constructible<gsl::span<int>, std::array<double, 3>&>::value,
  721. "!std::is_constructible<gsl::span<int>, std::array<double, 3>&>");
  722. static_assert(!std::is_constructible<gsl::span<int>, const std::array<int, 3>&>::value,
  723. "!std::is_constructible<gsl::span<int>, const std::array<int, 3>&>");
  724. static_assert(!std::is_constructible<gsl::span<int, 3>, int*, double*>::value,
  725. "!std::is_constructible<gsl::span<int, 3>, int*, double*>");
  726. static_assert(!std::is_constructible<gsl::span<int, 3>, int (&)[500]>::value,
  727. "!std::is_constructible<gsl::span<int, 3>, int(&)[500]>");
  728. static_assert(!std::is_constructible<gsl::span<int, 3>, const int*, int*>::value,
  729. "!std::is_constructible<gsl::span<int, 3>, const int*, int*>");
  730. static_assert(!std::is_constructible<gsl::span<int, 3>, const int*, const int*>::value,
  731. "!std::is_constructible<gsl::span<int, 3>, const int*, const int*>");
  732. static_assert(!std::is_constructible<gsl::span<int, 3>, const int*, std::size_t>::value,
  733. "!std::is_constructible<gsl::span<int, 3>, const int*, std::size_t>");
  734. static_assert(!std::is_constructible<gsl::span<int, 3>, const int*, double*>::value,
  735. "!std::is_constructible<gsl::span<int, 3>, const int*, double*>");
  736. static_assert(!std::is_constructible<gsl::span<int, 3>, const int (&)[3]>::value,
  737. "!std::is_constructible<gsl::span<int, 3>, const int(&)[3]>");
  738. static_assert(!std::is_constructible<gsl::span<int, 3>, double*, std::size_t>::value,
  739. "!std::is_constructible<gsl::span<int, 3>, double*, std::size_t>");
  740. static_assert(!std::is_constructible<gsl::span<int, 3>, double*, int*>::value,
  741. "!std::is_constructible<gsl::span<int, 3>, double*, int*>");
  742. static_assert(!std::is_constructible<gsl::span<int, 3>, double*, const int*>::value,
  743. "!std::is_constructible<gsl::span<int, 3>, double*, const int*>");
  744. static_assert(!std::is_constructible<gsl::span<int, 3>, double*, double*>::value,
  745. "!std::is_constructible<gsl::span<int, 3>, double*, double*>");
  746. static_assert(!std::is_constructible<gsl::span<int, 3>, double (&)[3]>::value,
  747. "!std::is_constructible<gsl::span<int, 3>, double(&)[3]>");
  748. static_assert(!std::is_constructible<gsl::span<int, 3>, std::size_t, int*>::value,
  749. "!std::is_constructible<gsl::span<int, 3>, std::size_t, int*>");
  750. static_assert(!std::is_constructible<gsl::span<int, 3>, std::size_t, std::size_t>::value,
  751. "!std::is_constructible<gsl::span<int, 3>, std::size_t, std::size_t>");
  752. static_assert(!std::is_constructible<gsl::span<int, 3>, std::array<double, 3>&>::value,
  753. "!std::is_constructible<gsl::span<int, 3>, std::array<double, 3>&>");
  754. static_assert(!std::is_constructible<gsl::span<int, 3>, std::array<int, 500>&>::value,
  755. "!std::is_constructible<gsl::span<int, 3>, std::array<int, 500>&>");
  756. static_assert(!std::is_constructible<gsl::span<int, 3>, const std::array<int, 3>&>::value,
  757. "!std::is_constructible<gsl::span<int, 3>, const std::array<int, 3>&>");
  758. static_assert(!std::is_constructible<gsl::span<int, 3>, const gsl::span<int, 500>&>::value,
  759. "!std::is_constructible<gsl::span<int, 3>, const gsl::span<int, 500>&>");
  760. static_assert(!std::is_constructible<gsl::span<int, 3>, const gsl::span<const int>&>::value,
  761. "!std::is_constructible<gsl::span<int, 3>, const gsl::span<const int>&>");
  762. static_assert(!std::is_constructible<gsl::span<int, 3>, const gsl::span<const int, 3>&>::value,
  763. "!std::is_constructible<gsl::span<int, 3>, const gsl::span<const int, 3>&>");
  764. static_assert(!std::is_constructible<gsl::span<int, 3>, const gsl::span<const int, 500>&>::value,
  765. "!std::is_constructible<gsl::span<int, 3>, const gsl::span<const int, 500>&>");
  766. static_assert(!std::is_constructible<gsl::span<int, 3>, const gsl::span<double, 3>&>::value,
  767. "!std::is_constructible<gsl::span<int, 3>, const gsl::span<double, 3>&>");
  768. static_assert(!std::is_constructible<gsl::span<const int>, double (&)[3]>::value,
  769. "!std::is_constructible<gsl::span<const int>, double(&)[3]>");
  770. static_assert(!std::is_constructible<gsl::span<const int>, std::array<double, 3>&>::value,
  771. "!std::is_constructible<gsl::span<const int>, std::array<double, 3>&>");
  772. static_assert(!std::is_constructible<gsl::span<const int>, const gsl::span<double, 3>&>::value,
  773. "!std::is_constructible<gsl::span<const int>, const gsl::span<double, 3>&>");
  774. static_assert(!std::is_constructible<gsl::span<const int, 3>, const gsl::span<int, 500>&>::value,
  775. "!std::is_constructible<gsl::span<const int, 3>, const gsl::span<int, 500>&>");
  776. static_assert(
  777. !std::is_constructible<gsl::span<const int, 3>, const gsl::span<const int, 500>&>::value,
  778. "!std::is_constructible<gsl::span<const int, 3>, const gsl::span<const int, 500>&>");
  779. static_assert(!std::is_constructible<gsl::span<const int, 3>, const gsl::span<double, 3>&>::value,
  780. "!std::is_constructible<gsl::span<const int, 3>, const gsl::span<double, 3>&>");
  781. static_assert(!std::is_constructible<gsl::span<Base>, Derived (&)[3]>::value,
  782. "!std::is_constructible<gsl::span<Base>, Derived(&)[3]>");
  783. static_assert(!std::is_constructible<gsl::span<Base>, std::array<Derived, 3>&>::value,
  784. "!std::is_constructible<gsl::span<Base>, std::array<Derived, 3>&>");
  785. static_assert(!std::is_constructible<gsl::span<Base>, std::vector<Derived>&>::value,
  786. "!std::is_constructible<gsl::span<Base>, std::vector<Derived>&>");
  787. static_assert(!std::is_constructible<gsl::span<Base>, const gsl::span<Derived>&>::value,
  788. "!std::is_constructible<gsl::span<Base>, const gsl::span<Derived>&>");
  789. static_assert(!std::is_constructible<gsl::span<Base>, const gsl::span<Derived, 3>&>::value,
  790. "!std::is_constructible<gsl::span<Base>, const gsl::span<Derived, 3>&>");
  791. static_assert(!std::is_constructible<gsl::span<Base, 3>, const gsl::span<Derived, 3>&>::value,
  792. "!std::is_constructible<gsl::span<Base, 3>, const gsl::span<Derived, 3>&>");
  793. static_assert(!std::is_constructible<gsl::span<Base, 3>, Derived (&)[3]>::value,
  794. "!std::is_constructible<gsl::span<Base, 3>, Derived(&)[3]>");
  795. static_assert(!std::is_constructible<gsl::span<Base, 3>, std::array<Derived, 3>&>::value,
  796. "!std::is_constructible<gsl::span<Base, 3>, std::array<Derived, 3>&>");
  797. static_assert(!std::is_constructible<gsl::span<const Base>, Derived (&)[3]>::value,
  798. "!std::is_constructible<gsl::span<const Base>, Derived(&)[3]>");
  799. static_assert(!std::is_constructible<gsl::span<const Base>, const Derived (&)[3]>::value,
  800. "!std::is_constructible<gsl::span<const Base>, const Derived(&)[3]>");
  801. static_assert(!std::is_constructible<gsl::span<const Base>, std::array<Derived, 3>&>::value,
  802. "!std::is_constructible<gsl::span<const Base>, std::array<Derived, 3>&>");
  803. static_assert(!std::is_constructible<gsl::span<const Base>, const std::array<Derived, 3>&>::value,
  804. "!std::is_constructible<gsl::span<const Base>, const std::array<Derived, 3>&>");
  805. static_assert(!std::is_constructible<gsl::span<const Base>, const gsl::span<Derived>&>::value,
  806. "!std::is_constructible<gsl::span<const Base>, const gsl::span<Derived>&>");
  807. static_assert(!std::is_constructible<gsl::span<const Base>, const gsl::span<Derived, 3>&>::value,
  808. "!std::is_constructible<gsl::span<const Base>, const gsl::span<Derived, 3>&>");
  809. static_assert(!std::is_constructible<gsl::span<const Base>, const gsl::span<const Derived>&>::value,
  810. "!std::is_constructible<gsl::span<const Base>, const gsl::span<const Derived>&>");
  811. static_assert(
  812. !std::is_constructible<gsl::span<const Base>, const gsl::span<const Derived, 3>&>::value,
  813. "!std::is_constructible<gsl::span<const Base>, const gsl::span<const Derived, 3>&>");
  814. static_assert(!std::is_constructible<gsl::span<const Base, 3>, const gsl::span<Derived, 3>&>::value,
  815. "!std::is_constructible<gsl::span<const Base, 3>, const gsl::span<Derived, 3>&>");
  816. static_assert(
  817. !std::is_constructible<gsl::span<const Base, 3>, const gsl::span<const Derived, 3>&>::value,
  818. "!std::is_constructible<gsl::span<const Base, 3>, const gsl::span<const Derived, 3>&>");
  819. static_assert(!std::is_constructible<gsl::span<const Derived>, std::array<Base, 3>&>::value,
  820. "!std::is_constructible<gsl::span<const Derived>, std::array<Base, 3>&>");
  821. static_assert(!std::is_constructible<gsl::span<const Derived>, const std::array<Base, 3>&>::value,
  822. "!std::is_constructible<gsl::span<const Derived>, const std::array<Base, 3>&>");
  823. // Explicit construction enabled in P1976R2
  824. static_assert(std::is_constructible<gsl::span<int, 3>, const gsl::span<int>&>::value,
  825. "std::is_constructible<gsl::span<int, 3>, const gsl::span<int>&>");
  826. static_assert(std::is_constructible<gsl::span<const int, 3>, const gsl::span<int>&>::value,
  827. "std::is_constructible<gsl::span<const int, 3>, const gsl::span<int>&>");
  828. static_assert(std::is_constructible<gsl::span<const int, 3>, const gsl::span<const int>&>::value,
  829. "std::is_constructible<gsl::span<const int, 3>, const gsl::span<const int>&>");
  830. // no throw copy constructor
  831. static_assert(std::is_nothrow_copy_constructible<gsl::span<int>>::value,
  832. "std::is_nothrow_copy_constructible<gsl::span<int>>");
  833. static_assert(std::is_nothrow_copy_constructible<gsl::span<int, 3>>::value,
  834. "std::is_nothrow_copy_constructible<gsl::span<int, 3>>");
  835. static_assert(std::is_nothrow_copy_constructible<gsl::span<const int>>::value,
  836. "std::is_nothrow_copy_constructible<gsl::span<const int>>");
  837. static_assert(std::is_nothrow_copy_constructible<gsl::span<const int, 3>>::value,
  838. "std::is_nothrow_copy_constructible<gsl::span<const int, 3>>");
  839. // no throw copy assignment
  840. static_assert(std::is_nothrow_copy_assignable<gsl::span<int>>::value,
  841. "std::is_nothrow_copy_assignable<gsl::span<int>>");
  842. static_assert(std::is_nothrow_copy_assignable<gsl::span<int, 3>>::value,
  843. "std::is_nothrow_copy_assignable<gsl::span<int, 3>>");
  844. static_assert(std::is_nothrow_copy_assignable<gsl::span<const int>>::value,
  845. "std::is_nothrow_copy_assignable<gsl::span<const int>>");
  846. static_assert(std::is_nothrow_copy_assignable<gsl::span<const int, 3>>::value,
  847. "std::is_nothrow_copy_assignable<gsl::span<const int, 3>>");
  848. // no throw destruction
  849. static_assert(std::is_nothrow_destructible<gsl::span<int>>::value,
  850. "std::is_nothrow_destructible<gsl::span<int>>");
  851. static_assert(std::is_nothrow_destructible<gsl::span<int, 3>>::value,
  852. "std::is_nothrow_destructible<gsl::span<int, 3>>");
  853. static_assert(std::is_nothrow_destructible<gsl::span<const int>>::value,
  854. "std::is_nothrow_destructible<gsl::span<const int>>");
  855. // conversions
  856. static_assert(std::is_convertible<int (&)[3], gsl::span<int>>::value,
  857. "std::is_convertible<int(&)[3], gsl::span<int>>");
  858. static_assert(std::is_convertible<int (&)[3], gsl::span<int, 3>>::value,
  859. "std::is_convertible<int(&)[3], gsl::span<int, 3>>");
  860. static_assert(std::is_convertible<int (&)[3], gsl::span<const int>>::value,
  861. "std::is_convertible<int(&)[3], gsl::span<const int>>");
  862. static_assert(std::is_convertible<const int (&)[3], gsl::span<const int>>::value,
  863. "std::is_convertible<const int(&)[3], gsl::span<const int>>");
  864. static_assert(std::is_convertible<const gsl::span<int>&, gsl::span<int>>::value,
  865. "std::is_convertible<const gsl::span<int>&, gsl::span<int>>");
  866. static_assert(std::is_convertible<const gsl::span<int>&, gsl::span<const int>>::value,
  867. "std::is_convertible<const gsl::span<int>&, gsl::span<const int>>");
  868. static_assert(std::is_convertible<const gsl::span<int, 3>&, gsl::span<int>>::value,
  869. "std::is_convertible<const gsl::span<int, 3>&, gsl::span<int>>");
  870. static_assert(std::is_convertible<const gsl::span<int, 3>&, gsl::span<int, 3>>::value,
  871. "std::is_convertible<const gsl::span<int, 3>&, gsl::span<int, 3>>");
  872. static_assert(std::is_convertible<const gsl::span<int, 3>&, gsl::span<const int>>::value,
  873. "std::is_convertible<const gsl::span<int, 3>&, gsl::span<const int>>");
  874. static_assert(std::is_convertible<const gsl::span<int, 3>&, gsl::span<const int, 3>>::value,
  875. "std::is_convertible<const gsl::span<int, 3>&, gsl::span<const int, 3>>");
  876. static_assert(std::is_convertible<const gsl::span<int, 500>&, gsl::span<int>>::value,
  877. "std::is_convertible<const gsl::span<int, 500>&, gsl::span<int>>");
  878. static_assert(std::is_convertible<const gsl::span<int, 500>&, gsl::span<const int>>::value,
  879. "std::is_convertible<const gsl::span<int, 500>&, gsl::span<const int>>");
  880. static_assert(std::is_convertible<const gsl::span<const int>&, gsl::span<const int>>::value,
  881. "std::is_convertible<const gsl::span<const int>&, gsl::span<const int>>");
  882. static_assert(std::is_convertible<const gsl::span<const int, 3>&, gsl::span<const int>>::value,
  883. "std::is_convertible<const gsl::span<const int, 3>&, gsl::span<const int>>");
  884. static_assert(std::is_convertible<const gsl::span<const int, 3>&, gsl::span<const int, 3>>::value,
  885. "std::is_convertible<const gsl::span<const int, 3>&, gsl::span<const int, 3>>");
  886. static_assert(std::is_convertible<const gsl::span<const int, 500>&, gsl::span<const int>>::value,
  887. "std::is_convertible<const gsl::span<const int, 500>&, gsl::span<const int>>");
  888. static_assert(std::is_convertible<std::array<int, 3>&, gsl::span<int>>::value,
  889. "std::is_convertible<std::array<int, 3>&, gsl::span<int>>");
  890. static_assert(std::is_convertible<std::array<int, 3>&, gsl::span<int, 3>>::value,
  891. "std::is_convertible<std::array<int, 3>&, gsl::span<int, 3>>");
  892. static_assert(std::is_convertible<std::array<int, 3>&, gsl::span<const int>>::value,
  893. "std::is_convertible<std::array<int, 3>&, gsl::span<const int>>");
  894. static_assert(std::is_convertible<const std::array<int, 3>&, gsl::span<const int>>::value,
  895. "std::is_convertible<const std::array<int, 3>&, gsl::span<const int>>");
  896. #if __cplusplus >= 201703l
  897. template <typename U, typename = void>
  898. static constexpr bool AsWritableBytesCompilesFor = false;
  899. template <typename U>
  900. static constexpr bool
  901. AsWritableBytesCompilesFor<U, void_t<decltype(as_writable_bytes(declval<U>()))>> = true;
  902. static_assert(AsWritableBytesCompilesFor<gsl::span<int>>,
  903. "AsWritableBytesCompilesFor<gsl::span<int>>");
  904. static_assert(AsWritableBytesCompilesFor<gsl::span<int, 9>>,
  905. "AsWritableBytesCompilesFor<gsl::span<int, 9>>");
  906. static_assert(!AsWritableBytesCompilesFor<gsl::span<const int>>,
  907. "!AsWritableBytesCompilesFor<gsl::span<const int>>");
  908. static_assert(!AsWritableBytesCompilesFor<gsl::span<const int, 9>>,
  909. "!AsWritableBytesCompilesFor<gsl::span<const int, 9>>");
  910. #endif // __cplusplus >= 201703l