C++ Algorithm Numeric | accumulate·reduce
이 글의 핵심
C++ <numeric> 헤더의 accumulate, reduce, transform_reduce, partial_sum, inner_product, iota 등 수치 알고리즘을 실전 예제와 함께 정리합니다.
들어가며
C++ <numeric> 헤더는 수치 연산에 특화된 알고리즘을 제공합니다. 합계, 곱셈, 내적, 누적 합 등 수학적 연산을 표준 라이브러리로 간결하게 표현할 수 있으며, C++17부터는 병렬 실행 정책을 지원해 대용량 데이터 처리 성능을 크게 향상시킬 수 있습니다.
이 글을 읽으면
accumulate,reduce,transform_reduce의 차이를 이해합니다partial_sum,inclusive_scan,exclusive_scan으로 누적 연산을 구현합니다- 병렬 실행 정책으로 성능을 최적화합니다
- 실무에서 자주 사용하는 패턴을 익힙니다
기본 알고리즘
주요 알고리즘 목록
| 알고리즘 | 용도 | C++ 버전 |
|---|---|---|
| accumulate | 범위 집계 (순차) | C++98 |
| reduce | 범위 집계 (병렬 가능) | C++17 |
| transform_reduce | 변환 후 집계 | C++17 |
| inner_product | 내적 | C++98 |
| partial_sum | 누적 합 | C++98 |
| inclusive_scan | 누적 합 (병렬) | C++17 |
| exclusive_scan | 누적 합 (현재 제외) | C++17 |
| adjacent_difference | 인접 차이 | C++98 |
| iota | 순차 값 생성 | C++11 |
실전 구현
1) accumulate - 범위 집계
시그니처:
template<class InputIt, class T>
T accumulate(InputIt first, InputIt last, T init);
template<class InputIt, class T, class BinaryOp>
T accumulate(InputIt first, InputIt last, T init, BinaryOp op);
기본 사용
#include <numeric>
#include <vector>
#include <iostream>
int main() {
std::vector<int> v = {1, 2, 3, 4, 5};
// 합계
int sum = std::accumulate(v.begin(), v.end(), 0);
std::cout << "합: " << sum << std::endl; // 15
// 곱
int product = std::accumulate(v.begin(), v.end(), 1,
[](int a, int b) { return a * b; });
std::cout << "곱: " << product << std::endl; // 120
return 0;
}
커스텀 연산
#include <numeric>
#include <vector>
#include <string>
int main() {
std::vector<std::string> words = {"Hello", " ", "World", "!"};
// 문자열 연결
std::string sentence = std::accumulate(
words.begin(),
words.end(),
std::string(""),
[](const std::string& a, const std::string& b) {
return a + b;
}
);
std::cout << sentence << std::endl; // Hello World!
return 0;
}
시간 복잡도: O(n)
공간 복잡도: O(1)
2) reduce - 병렬 집계 (C++17)
시그니처:
template<class ExecutionPolicy, class ForwardIt, class T>
T reduce(ExecutionPolicy&& policy, ForwardIt first, ForwardIt last, T init);
기본 사용
#include <numeric>
#include <vector>
#include <execution>
#include <iostream>
int main() {
std::vector<int> v(1000000, 1);
// 순차 실행
auto sum1 = std::reduce(v.begin(), v.end(), 0);
// 병렬 실행
auto sum2 = std::reduce(std::execution::par, v.begin(), v.end(), 0);
// 병렬 + 벡터화
auto sum3 = std::reduce(std::execution::par_unseq, v.begin(), v.end(), 0);
std::cout << "합: " << sum2 << std::endl; // 1000000
return 0;
}
accumulate vs reduce
#include <numeric>
#include <vector>
#include <iostream>
int main() {
std::vector<double> v = {1.0, 2.0, 3.0, 4.0, 5.0};
// accumulate: 순서 보장 (왼쪽부터)
double sum1 = std::accumulate(v.begin(), v.end(), 0.0);
// reduce: 순서 보장 안 됨 (병렬 가능)
double sum2 = std::reduce(v.begin(), v.end(), 0.0);
// 부동소수점은 순서에 따라 결과 미세하게 다를 수 있음
std::cout << "accumulate: " << sum1 << std::endl;
std::cout << "reduce: " << sum2 << std::endl;
return 0;
}
주의사항:
reduce는 결합법칙을 가정- 부동소수점은 순서에 따라 결과 다를 수 있음
- 병렬 실행 시 데이터 경합 주의
3) transform_reduce - 변환 후 집계 (C++17)
시그니처:
template<class ExecutionPolicy, class ForwardIt1, class ForwardIt2, class T>
T transform_reduce(ExecutionPolicy&& policy,
ForwardIt1 first1, ForwardIt1 last1,
ForwardIt2 first2, T init);
내적 (Dot Product)
#include <numeric>
#include <vector>
#include <execution>
#include <iostream>
int main() {
std::vector<int> v1 = {1, 2, 3, 4, 5};
std::vector<int> v2 = {2, 2, 2, 2, 2};
// 내적: v1[i] * v2[i]의 합
int dotProduct = std::transform_reduce(
std::execution::par,
v1.begin(), v1.end(),
v2.begin(),
);
std::cout << "내적: " << dotProduct << std::endl; // 30
return 0;
}
제곱합
#include <numeric>
#include <vector>
#include <execution>
int main() {
std::vector<int> v = {1, 2, 3, 4, 5};
// 제곱합: sum(v[i]^2)
int sumOfSquares = std::transform_reduce(
std::execution::par,
v.begin(), v.end(),
0,
std::plus<>(),
[](int x) { return x * x; }
);
std::cout << "제곱합: " << sumOfSquares << std::endl; // 55
return 0;
}
시간 복잡도: O(n)
공간 복잡도: O(1)
4) inner_product - 내적
시그니처:
template<class InputIt1, class InputIt2, class T>
T inner_product(InputIt1 first1, InputIt1 last1,
InputIt2 first2, T init);
기본 사용
#include <numeric>
#include <vector>
#include <iostream>
int main() {
std::vector<int> v1 = {1, 2, 3};
std::vector<int> v2 = {4, 5, 6};
// 내적: 1*4 + 2*5 + 3*6 = 32
int result = std::inner_product(v1.begin(), v1.end(), v2.begin(), 0);
std::cout << "내적: " << result << std::endl; // 32
return 0;
}
커스텀 연산
#include <numeric>
#include <vector>
int main() {
std::vector<int> v1 = {1, 2, 3};
std::vector<int> v2 = {4, 5, 6};
// 합(곱) 대신 곱(합) 사용
// (1+4) * (2+5) * (3+6) = 5 * 7 * 9 = 315
int result = std::inner_product(
v1.begin(), v1.end(), v2.begin(), 1,
std::multiplies<>(), // 외부 연산: 곱
std::plus<>() // 내부 연산: 합
);
std::cout << "결과: " << result << std::endl; // 315
return 0;
}
5) partial_sum - 누적 합
시그니처:
template<class InputIt, class OutputIt>
OutputIt partial_sum(InputIt first, InputIt last, OutputIt d_first);
기본 사용
#include <numeric>
#include <vector>
#include <iostream>
int main() {
std::vector<int> v = {1, 2, 3, 4, 5};
std::vector<int> result(v.size());
// 누적 합: [1, 1+2, 1+2+3, 1+2+3+4, 1+2+3+4+5]
std::partial_sum(v.begin(), v.end(), result.begin());
for (int x : result) {
std::cout << x << " "; // 1 3 6 10 15
}
std::cout << std::endl;
return 0;
}
누적 곱
#include <numeric>
#include <vector>
int main() {
std::vector<int> v = {1, 2, 3, 4, 5};
std::vector<int> result(v.size());
// 누적 곱
std::partial_sum(v.begin(), v.end(), result.begin(),
std::multiplies<>());
for (int x : result) {
std::cout << x << " "; // 1 2 6 24 120
}
return 0;
}
6) inclusive_scan vs exclusive_scan (C++17)
inclusive_scan
#include <numeric>
#include <vector>
#include <execution>
#include <iostream>
int main() {
std::vector<int> v = {1, 2, 3, 4, 5};
std::vector<int> result(v.size());
// 누적 합 (병렬)
std::inclusive_scan(
std::execution::par,
v.begin(), v.end(),
result.begin()
);
for (int x : result) {
std::cout << x << " "; // 1 3 6 10 15
}
return 0;
}
exclusive_scan
#include <numeric>
#include <vector>
#include <execution>
int main() {
std::vector<int> v = {1, 2, 3, 4, 5};
std::vector<int> result(v.size());
// 누적 합 (현재 원소 제외)
std::exclusive_scan(
std::execution::par,
v.begin(), v.end(),
result.begin(),
0 // 초기값
);
for (int x : result) {
std::cout << x << " "; // 0 1 3 6 10
}
return 0;
}
차이점:
inclusive_scan: 현재 원소 포함exclusive_scan: 현재 원소 제외
7) adjacent_difference - 인접 차이
#include <numeric>
#include <vector>
#include <iostream>
int main() {
std::vector<int> v = {1, 3, 6, 10, 15};
std::vector<int> result(v.size());
// 인접 차이: [v[0], v[1]-v[0], v[2]-v[1], ...]
std::adjacent_difference(v.begin(), v.end(), result.begin());
for (int x : result) {
std::cout << x << " "; // 1 2 3 4 5
}
return 0;
}
8) iota - 순차 값 생성
#include <numeric>
#include <vector>
#include <iostream>
int main() {
std::vector<int> v(10);
// 1부터 순차 생성
std::iota(v.begin(), v.end(), 1);
for (int x : v) {
std::cout << x << " "; // 1 2 3 4 5 6 7 8 9 10
}
return 0;
}
고급 활용
1) 병렬 실행 정책
실행 정책:
| 정책 | 설명 | 사용 시나리오 |
|---|---|---|
| seq | 순차 실행 | 기본 (순서 보장) |
| par | 병렬 실행 | 멀티코어 활용 |
| par_unseq | 병렬 + 벡터화 | SIMD 최적화 |
벤치마크
#include <numeric>
#include <vector>
#include <execution>
#include <chrono>
#include <iostream>
int main() {
std::vector<int> v(10000000, 1);
auto start = std::chrono::high_resolution_clock::now();
// 순차
auto sum1 = std::reduce(v.begin(), v.end(), 0);
auto mid = std::chrono::high_resolution_clock::now();
// 병렬
auto sum2 = std::reduce(std::execution::par, v.begin(), v.end(), 0);
auto end = std::chrono::high_resolution_clock::now();
auto seq_time = std::chrono::duration_cast<std::chrono::milliseconds>(mid - start).count();
auto par_time = std::chrono::duration_cast<std::chrono::milliseconds>(end - mid).count();
std::cout << "순차: " << seq_time << "ms" << std::endl;
std::cout << "병렬: " << par_time << "ms" << std::endl;
std::cout << "배속: " << (double)seq_time / par_time << "x" << std::endl;
return 0;
}
2) transform_reduce 고급 패턴
가중 평균
#include <numeric>
#include <vector>
#include <execution>
double weighted_average(const std::vector<double>& values,
const std::vector<double>& weights) {
double sum = std::transform_reduce(
std::execution::par,
values.begin(), values.end(),
weights.begin(),
);
double weight_sum = std::reduce(
std::execution::par,
weights.begin(), weights.end(),
);
return sum / weight_sum;
}
int main() {
std::vector<double> values = {85, 90, 78, 92};
std::vector<double> weights = {0.3, 0.3, 0.2, 0.2};
double avg = weighted_average(values, weights);
std::cout << "가중 평균: " << avg << std::endl; // 86.7
return 0;
}
3) 범위 기반 누적 (C++20 Ranges)
#include <numeric>
#include <vector>
#include <ranges>
#include <iostream>
int main() {
std::vector<int> v = {1, 2, 3, 4, 5};
// C++20 ranges
auto sum = std::accumulate(
v | std::views::filter([](int x) { return x % 2 == 0; }),
);
std::cout << "짝수 합: " << sum << std::endl; // 6 (2+4)
return 0;
}
성능 비교
accumulate vs reduce 벤치마크
테스트: 1천만 개 정수 합계
| 알고리즘 | 실행 정책 | 시간 | 배속 |
|---|---|---|---|
| accumulate | - | 25ms | 1x |
| reduce | seq | 26ms | 1x |
| reduce | par | 8ms | 3.1x |
| reduce | par_unseq | 6ms | 4.2x |
| 결론: 병렬 실행으로 4배 개선 |
메모리 사용량
| 알고리즘 | 추가 메모리 | 비고 |
|---|---|---|
| accumulate | O(1) | In-place |
| reduce | O(1) | In-place |
| partial_sum | O(n) | 출력 버퍼 |
| inclusive_scan | O(n) | 출력 버퍼 |
실무 사례
사례 1: 통계 계산 - 평균, 분산, 표준편차
#include <numeric>
#include <vector>
#include <cmath>
#include <execution>
#include <iostream>
class Statistics {
public:
static double mean(const std::vector<double>& data) {
if (data.empty()) return 0.0;
double sum = std::reduce(
std::execution::par,
data.begin(), data.end(),
);
return sum / data.size();
}
static double variance(const std::vector<double>& data) {
if (data.size() < 2) return 0.0;
double avg = mean(data);
double sum_sq_diff = std::transform_reduce(
std::execution::par,
data.begin(), data.end(),
0.0,
std::plus<>(),
[avg](double x) {
double diff = x - avg;
return diff * diff;
}
);
return sum_sq_diff / (data.size() - 1);
}
static double stddev(const std::vector<double>& data) {
return std::sqrt(variance(data));
}
};
int main() {
std::vector<double> scores = {85, 90, 78, 92, 88, 76, 95};
std::cout << "평균: " << Statistics::mean(scores) << std::endl;
std::cout << "분산: " << Statistics::variance(scores) << std::endl;
std::cout << "표준편차: " << Statistics::stddev(scores) << std::endl;
return 0;
}
사례 2: 금융 계산 - 복리 이자
#include <numeric>
#include <vector>
#include <cmath>
double compound_interest(double principal, double rate, int years) {
std::vector<double> rates(years, 1.0 + rate);
// 복리: principal * (1+rate)^years
double multiplier = std::accumulate(
rates.begin(), rates.end(),
1.0,
std::multiplies<>()
);
return principal * multiplier;
}
int main() {
double principal = 1000000; // 100만원
double rate = 0.05; // 5% 연이율
int years = 10;
double result = compound_interest(principal, rate, years);
std::cout << "10년 후: " << result << "원" << std::endl;
// 약 1,628,895원
return 0;
}
사례 3: 데이터 분석 - 이동 평균
#include <numeric>
#include <vector>
#include <deque>
#include <iostream>
std::vector<double> moving_average(const std::vector<double>& data, size_t window) {
std::vector<double> result;
std::deque<double> window_data;
double sum = 0.0;
for (size_t i = 0; i < data.size(); ++i) {
window_data.push_back(data[i]);
sum += data[i];
if (window_data.size() > window) {
sum -= window_data.front();
window_data.pop_front();
}
if (window_data.size() == window) {
result.push_back(sum / window);
}
}
return result;
}
int main() {
std::vector<double> prices = {100, 102, 101, 105, 103, 107, 110};
auto ma = moving_average(prices, 3);
std::cout << "3일 이동 평균: ";
for (double avg : ma) {
std::cout << avg << " ";
}
// 101 102.67 103 105 106.67
return 0;
}
트러블슈팅
문제 1: 초기값 타입 불일치
증상: 컴파일 오류 또는 잘못된 결과
std::vector<int> v = {1, 2, 3, 4, 5};
// ❌ 잘못된 초기값 타입
double sum = std::accumulate(v.begin(), v.end(), 0); // int로 계산됨
// ✅ 올바른 초기값
double sum = std::accumulate(v.begin(), v.end(), 0.0);
문제 2: 오버플로우
증상: 큰 수의 합계가 음수로 나옴
std::vector<int> v = {1000000, 1000000, 1000000};
// ❌ int 오버플로우
int sum = std::accumulate(v.begin(), v.end(), 0);
// 결과: -1294967296 (오버플로우)
// ✅ long long 사용
long long sum = std::accumulate(v.begin(), v.end(), 0LL);
// 결과: 3000000
문제 3: 부동소수점 정밀도
증상: reduce와 accumulate 결과가 다름
std::vector<double> v = {0.1, 0.2, 0.3, 0.4, 0.5};
// accumulate: 순서 보장
double sum1 = std::accumulate(v.begin(), v.end(), 0.0);
// reduce: 순서 보장 안 됨
double sum2 = std::reduce(v.begin(), v.end(), 0.0);
// 미세한 차이 발생 가능
해결: 순서가 중요하면 accumulate 사용
문제 4: 병렬 실행 데이터 경합
증상: 병렬 실행 시 잘못된 결과
int counter = 0;
// ❌ 데이터 경합
std::for_each(std::execution::par, v.begin(), v.end(),
[&counter](int x) { counter += x; }); // 경합!
// ✅ reduce 사용
int sum = std::reduce(std::execution::par, v.begin(), v.end(), 0);
마무리
C++ <numeric> 헤더는 수치 연산을 표준 라이브러리로 간결하게 표현할 수 있게 합니다.
핵심 요약
- 집계
accumulate: 순차 집계 (순서 보장)reduce: 병렬 집계 (순서 비보장)transform_reduce: 변환 후 집계
- 누적
partial_sum: 누적 합 (순차)inclusive_scan: 누적 합 (병렬, 현재 포함)exclusive_scan: 누적 합 (병렬, 현재 제외)
- 기타
inner_product: 내적adjacent_difference: 인접 차이iota: 순차 값 생성
선택 가이드
| 상황 | 알고리즘 |
|---|---|
| 순차 합계 | accumulate |
| 병렬 합계 | reduce (par) |
| 내적 | inner_product 또는 transform_reduce |
| 누적 합 | partial_sum 또는 inclusive_scan |
| 순차 생성 | iota |
코드 예제 치트시트
// 합계
int sum = std::accumulate(v.begin(), v.end(), 0);
// 곱
int product = std::accumulate(v.begin(), v.end(), 1, std::multiplies<>());
// 병렬 합계
int sum = std::reduce(std::execution::par, v.begin(), v.end(), 0);
// 내적
int dot = std::inner_product(v1.begin(), v1.end(), v2.begin(), 0);
// 누적 합
std::partial_sum(v.begin(), v.end(), result.begin());
// 순차 생성
std::iota(v.begin(), v.end(), 1);
다음 단계
- 알고리즘 가이드: C++ 알고리즘 완벽 가이드
- 생성 알고리즘: C++ Algorithm Generate
- 힙 알고리즘: C++ Algorithm Heap
참고 자료
- cppreference: https://en.cppreference.com/w/cpp/algorithm
- “C++17 The Complete Guide” - Nicolai M. Josuttis
- “Effective STL” - Scott Meyers
한 줄 정리: 수치 연산은
<numeric>알고리즘으로 간결하게 표현하고, 대용량 데이터는 병렬 실행 정책으로 최적화한다.
심화 부록: 구현·운영 관점
이 부록은 앞선 본문에서 다룬 주제(「C++ Algorithm Numeric | accumulate·reduce·inner_product 완벽 정리」)를 구현·런타임·운영 관점에서 다시 압축합니다. 도메인별 세부 구현은 글마다 다르지만, 입력 검증 → 핵심 연산 → 부작용(I/O·네트워크·동시성) → 관측의 흐름으로 장애를 나누면 원인 추적이 빨라집니다.
내부 동작과 핵심 메커니즘
flowchart TD A[입력·요청·이벤트] --> B[파싱·검증·디코딩] B --> C[핵심 연산·상태 전이] C --> D[부작용: I/O·네트워크·동시성] D --> E[결과·관측·저장]
sequenceDiagram participant C as 클라이언트/호출자 participant B as 경계(런타임·게이트웨이·프로세스) participant D as 의존성(API·DB·큐·파일) C->>B: 요청/이벤트 B->>D: 조회·쓰기·RPC D-->>B: 지연·부분 실패·재시도 가능 B-->>C: 응답 또는 오류(코드·상관 ID)
- 불변 조건(Invariant): 버퍼 경계, 프로토콜 상태, 트랜잭션 격리, FD 상한 등 단계별로 문장으로 적어 두면 디버깅 비용이 줄어듭니다.
- 결정성: 순수 층과 시간·네트워크·스케줄에 의존하는 층을 분리해야 테스트와 장애 분석이 쉬워집니다.
- 경계 비용: 직렬화, 인코딩, syscall 횟수, 락 경합, 할당·GC, 캐시 미스를 의심 목록에 둡니다.
- 백프레셔: 생산자가 소비자보다 빠를 때 버퍼·큐·스트림에서 속도를 줄이는 신호를 어디에 둘지 정의합니다.
프로덕션 운영 패턴
| 영역 | 운영 관점 질문 |
|---|---|
| 관측성 | 요청 단위 상관 ID, 에러율·지연 p95/p99, 의존성 타임아웃·재시도가 대시보드에 보이는가 |
| 안전성 | 입력 검증·권한·비밀·감사 로그가 코드 경로마다 일관적인가 |
| 신뢰성 | 재시도는 멱등 연산에만 적용되는가, 서킷 브레이커·백오프·DLQ가 있는가 |
| 성능 | 캐시·배치 크기·커넥션 풀·인덱스·백프레셔가 데이터 규모에 맞는가 |
| 배포 | 롤백 룬북, 카나리/블루그린, 마이그레이션·피처 플래그가 문서화되어 있는가 |
| 용량 | 피크 트래픽·디스크·FD·스레드 풀 상한을 주기적으로 검증하는가 |
스테이징은 데이터 양·네트워크 RTT·동시성을 프로덕션에 가깝게 맞출수록 재현율이 올라갑니다.
확장 예시: 엔드투엔드 미니 시나리오
앞선 본문 주제(「C++ Algorithm Numeric | accumulate·reduce·inner_product 완벽 정리」)를 배포·운영 흐름에 맞춰 옮긴 체크리스트입니다. 도메인에 맞게 단계 이름만 바꿔 적용할 수 있습니다.
- 입력 계약 고정: 스키마·버전·최대 페이로드·타임아웃·에러 코드를 경계에 둔다.
- 핵심 경로 계측: 요청 ID, 단계별 지연, 외부 호출 결과 코드를 로그·메트릭·트레이스에서 한 흐름으로 본다.
- 실패 주입: 의존성 타임아웃·5xx·부분 데이터·락 대기를 스테이징에서 재현한다.
- 호환·롤백: 설정/마이그레이션/클라이언트 버전을 되돌릴 수 있는지 확인한다.
- 부하 후 검증: 피크 대비 p95/p99, 에러율, 리소스 상한, 알림 임계값을 점검한다.
handle(request):
ctx = newCorrelationId()
validated = validateSchema(request)
authorize(validated, ctx)
result = domainCore(validated)
persistOrEmit(result, idempotentKey)
recordMetrics(ctx, latency, outcome)
return result
문제 해결(Troubleshooting)
| 증상 | 가능 원인 | 조치 |
|---|---|---|
| 간헐적 실패 | 레이스, 타임아웃, 외부 의존성, DNS | 최소 재현 스크립트, 분산 트레이스·로그 상관관계, 재시도·서킷 설정 점검 |
| 성능 저하 | N+1, 동기 I/O, 락 경합, 과도한 직렬화, 캐시 미스 | 프로파일러·APM으로 핫스팟 확인 후 한 가지씩 제거 |
| 메모리 증가 | 캐시 무제한, 구독/리스너 누수, 대용량 버퍼, 커넥션 미반납 | 상한·TTL·힙/FD 스냅샷 비교 |
| 빌드·배포만 실패 | 환경 변수, 권한, 플랫폼 차이, lockfile | CI 로그와 로컬 diff, 런타임·이미지 버전 핀 |
| 설정 불일치 | 프로필·시크릿·기본값, 리전 | 스키마 검증된 설정 단일 소스와 배포 매트릭스 표준화 |
| 데이터 불일치 | 비멱등 재시도, 부분 쓰기, 캐시 무효화 누락 | 멱등 키·아웃박스·트랜잭션 경계 재검토 |
권장 순서: (1) 최소 재현 (2) 최근 변경 범위 축소 (3) 환경·의존성 차이 (4) 관측으로 가설 검증 (5) 수정 후 회귀·부하 테스트.
배포 전에는 git add → git commit → git push 후 npm run deploy 순서를 권장합니다.
자주 묻는 질문 (FAQ)
Q. 이 내용을 실무에서 언제 쓰나요?
A. C++
Q. 선행으로 읽으면 좋은 글은?
A. 각 글 하단의 이전 글 또는 관련 글 링크를 따라가면 순서대로 배울 수 있습니다. C++ 시리즈 목차에서 전체 흐름을 확인할 수 있습니다.
Q. 더 깊이 공부하려면?
A. cppreference와 해당 라이브러리 공식 문서를 참고하세요. 글 말미의 참고 자료 링크도 활용하면 좋습니다.
같이 보면 좋은 글 (내부 링크)
이 주제와 연결되는 다른 글입니다.
- C++ async & launch | std::async·future·launch 정책 완벽 정리
- C++ Parallel Algorithms | ‘병렬 알고리즘’ 가이드
- C++ Execution Policy | ‘실행 정책’ 가이드
이 글에서 다루는 키워드 (관련 검색어)
C++, 알고리즘, numeric, reduce, STL, accumulate 등으로 검색하시면 이 글이 도움이 됩니다.