accumulate的用法
来源:互联网 发布:python实现bp算法 编辑:程序博客网 时间:2024/06/04 18:14
#include <iostream>#include <vector>#include <string>#include <numeric>#include <functional>#include <algorithm>using namespace std;string::size_type stringLengthSum(string::size_type SumSoFar,const string& s){return SumSoFar+s.size();}int main(){vector<string> vec;vec.push_back("a");vec.push_back("bc");vec.push_back("dfe");vec.push_back("ghij");string::size_type lengthSum=accumulate(vec.begin(),vec.end(),static_cast<string::size_type>(0),stringLengthSum);cout<<lengthSum<<endl;vector<float> vec1;vec1.push_back(1.0);vec1.push_back(2.0);vec1.push_back(3.0);vec1.push_back(4.0);vec1.push_back(5.0);float product=accumulate(vec1.begin(),vec1.end(),1.0f,multiplies<float>());cout<<product<<endl;return 0;}
0 0
- accumulate的用法
- accumulate的用法
- C++的STL中accumulate的用法
- C++的STL中accumulate的用法
- C++ find accumulate count的用法
- accumulate函数用法
- c++ accumulate 用法 原理剖析
- "accumulate"的思考
- accumulate
- accumulate
- accumulate
- [C++] vector 之 accumulate 用法示例
- jsonobject的element和accumulate
- STL中accumulate函数的使用
- STL中accumulate函数的使用
- 由accumulate()扩展出来的一系列方法
- JSONObject put,accumulate,element的区别
- JSONObject put,accumulate,element的区别
- Linux五种IO模型
- GoogleMap移动Marker时添加动画
- pyCharm2016版中python路径的更改(Windows系统)
- Oracle中复制表结构和表数据
- acm常用公式
- accumulate的用法
- max fd size
- 调用 C 接口
- java的(PO,VO,TO,BO,DAO,POJO)解释
- 初学c/c++——定义结构体(struct)
- 根据Email地址跳转到邮箱登录界面
- iOS笔记 js 交互
- Centos 6.5 基于PXE自动安装Linux
- HashMap和ConcurrentHashMap的区别