From 11712ab019a700307c98c6388e29b296d0ca16c8 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Fri, 17 Jan 2025 14:31:47 -0800 Subject: [PATCH] chore: use c++ 11 --- meson.build | 2 +- src/chapter_2/lab_3/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 1c9141f..ea4d3e1 100644 --- a/meson.build +++ b/meson.build @@ -2,7 +2,7 @@ project( 'cs010b-work', 'cpp', version: '0.1', - default_options: ['warning_level=3', 'cpp_std=c++23'], + default_options: ['warning_level=3', 'cpp_std=c++11'], ) c_1_lab_1 = executable('c_1_lab_1', 'src/chapter_1/c_1_lab_1.cpp', install: true) diff --git a/src/chapter_2/lab_3/main.cpp b/src/chapter_2/lab_3/main.cpp index 6ce2657..ad0051c 100644 --- a/src/chapter_2/lab_3/main.cpp +++ b/src/chapter_2/lab_3/main.cpp @@ -44,7 +44,7 @@ int main(int argc, char *argv[]) { input.close(); // Get integer average of all values read in. - int sum = std::accumulate(values.begin(), values.end(), 0); + int sum = std::accumulate(values.begin(), values.end(), 0, std::plus()); int average = sum / static_cast(values.size()); // Convert each value within vector to be the difference between the original