From aa3152be56db430364ce14c5bf18bc63e6e91b9e Mon Sep 17 00:00:00 2001 From: Gabriel Date: Mon, 15 Apr 2019 13:33:32 -0400 Subject: [PATCH] Remove std::experimental::dynarray from array passing example --- common-tasks/functions/pass-arrays.cpp | 29 +++++--------------------- 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/common-tasks/functions/pass-arrays.cpp b/common-tasks/functions/pass-arrays.cpp index 285a8a7..73ed973 100644 --- a/common-tasks/functions/pass-arrays.cpp +++ b/common-tasks/functions/pass-arrays.cpp @@ -1,24 +1,16 @@ // Pass arrays -// C++11, Experimental +// C++11 #include -#include void compile_time(std::array arr) { } -void run_time(std::experimental::dynarray arr) -{ } - int main() { std::array arr = {4, 8, 15}; compile_time(arr); compile_time({16, 23, 42}); - - std::experimental::dynarray dynarr = {1, 2, 3}; - run_time(dynarr); - run_time({1, 2, 3, 4, 5}); } // Pass fixed-size arrays to and from functions. @@ -26,23 +18,12 @@ int main() // Built-in array types are not copyable, so cannot be passed to and // from functions by value. The traditional approach is to pass both a // pointer to an array's first element and the size of the array. -// However, C++ provides class types that represent copyable -// fixed-size arrays. +// However, C++ provides a class type that represents a copyable +// fixed-size array. // -// We define the function `compile_time`, on [7-8], to have a +// We define the function `compile_time`, on [6-7], to have a // parameter of type [`std::array`](cpp/container/array), which represents // *compile-time* fixed-size arrays. This means that the size must be // known at compile time. A template may be used to instantiate -// functions for different `std::array` sizes. [!15-17] demonstrate +// functions for different `std::array` sizes. [!11-13] demonstrate // passing arrays of size 3 to this function. -// -// On [10-11], we define function `run_time` to have a parameter of type -// [`std::experimental::dynarray`](cpp/container/dynarray), which -// represents *run-time* fixed-size arrays. This type can be created with -// any size at run time, but cannot change size once created. [!19-21] -// demonstrate passing arrays of various sizes to this function. -// -// **Note**: `std::experimental::dynarray` is part of the Arrays -// Technical Specification, which provides experimental features that -// may soon be introduced to the C++ standard. It should not be used -// in production code.