From 2ee90625e793175c5fcde47564326a7eb8a1b3ee Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sun, 13 Dec 2020 17:13:45 +0100 Subject: Added cpp06/ex00 --- cpp07/ex01/iter.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'cpp07') diff --git a/cpp07/ex01/iter.cpp b/cpp07/ex01/iter.cpp index 80b29d3..831286f 100644 --- a/cpp07/ex01/iter.cpp +++ b/cpp07/ex01/iter.cpp @@ -6,23 +6,24 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/14 20:02:19 by charles #+# #+# */ -/* Updated: 2020/04/14 20:12:17 by charles ### ########.fr */ +/* Updated: 2020/12/11 15:45:09 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #include template -void iter(T* ptr, size_t len, void (*f)(T* x)) +void iter(T* ptr, size_t len, void (*f)(T const& x)) { for (size_t i = 0; i < len; i++) - f(ptr + i); + f(ptr[i]); } +/* sel-melc says const& */ template -void timeTwo(T* x) +void timeTwo(T const& x) { - *x *= 2; + x *= 2; } int main() -- cgit