From 74b5debe8c4a7662941d91a4ba702e745f763040 Mon Sep 17 00:00:00 2001 From: Johannes Laire Date: Tue, 29 Sep 2015 11:01:26 +0200 Subject: [PATCH] Add an example --- CppCoreGuidelines.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index e55bf44..595f2c1 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -1435,6 +1435,10 @@ Use `const` for the "from" argument: void copy_n(const T* p, T* q, int n); // copy from [p:p+n) to [q:q+n) +**Example**: If the order of the parameters is not important, there is no problem: + + int max(int a, int b); + **Alternative**: Don't pass arrays as pointers, pass an object representing a range (e.g., an `array_view`): void copy_n(array_view p, array_view q); // copy from p to q