티스토리 뷰

노트

c++) transform 함수

tose33 2021. 10. 21. 14:55

https://en.cppreference.com/w/cpp/algorithm/transform

 

std::transform - cppreference.com

(1) template< class InputIt, class OutputIt, class UnaryOperation > OutputIt transform( InputIt first1, InputIt last1, OutputIt d_first,                     UnaryOperation unary_op ); (until C++20) template< class InputIt, class OutputIt, class U

en.cppreference.com

 

#include <algorithm>

벡터와 같은 컨테이너의 특정 범위에 특정 함수를 적용할때 유용.

범위 first1 부터 last1 까지 unary_op를 적용하고, d_first에서 부터 저장.

 

벡터의 모든 범위에 값을 두배로 하는 함수를 적용:

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2026/02   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
글 보관함