| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
nbby
8年前发布

C++ 编码库:FunctionalPlus

FunctionalPlus 是一个小的表头库,它可以降低代码噪声,一次只处理一个单一等级的的抽象对象。通过增加你的代码的简洁性和可维护性来提高生产效率和编码乐趣。从长远的角度来看,它可以通过提供易于使用的功能将你从实现控制的流中解放出来。

示例代码:

#include "FunctionalPlus/FunctionalPlus.h"#include <iostream>  // std::list<std::uint64_t> CollatzSeq(std::uint64_t x) { ... }int main()  {    using namespace FunctionalPlus;      using namespace std;         typedef list<uint64_t> Ints;          // [1, 2, 3 ... 29]      auto numbers = GenerateIntegralRange<Ints>(1, 30);          // A function that does [1, 2, 3, 4, 5] -> "[1 => 2 => 3 => 4 => 5]"      auto ShowInts = Bind1of2(ShowContWith<Ints>, " => ");          // A composed function that calculates a Collatz sequence and shows it.      auto ShowCollatsSeq = Compose(CollatzSeq, ShowInts);          // Apply it to all our numbers.      auto seqStrs = Transform(ShowCollatsSeq, numbers);          // Combine the numbers and their sequence representations into a map.      auto collatzDict = CreateMap(numbers, seqStrs);          // Print some of the sequences.      cout << collatzDict[13] << endl;      cout << collatzDict[17] << endl;  }

项目主页:http://www.open-open.com/lib/view/home/1448886348170

 本文由用户 nbby 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1448886348170.html
C/C++开发 FunctionalPlus