在C ++中进行函数式编程 [英] Functional Programming in C++

查看:96
本文介绍了在C ++中进行函数式编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以指导我如何在C ++中进行函数式编程?是否有一些很好的在线资料可供参考?



请注意,我知道库FC ++。我想知道如何单独使用C ++标准库。



谢谢。

解决方案< 2014年8月更新:这个答案发布于2009年。C ++ 11对于C ++中的函数式编程有了相当大的改进,所以这个答案不再准确。我将它留在下面作为历史记录。



由于这个答案是被接受的 - 我把它变成一个社区Wiki。您可以自由地通过协作改进它,在使用现代C ++的函数式编程中添加真正的技巧。






你不能这样做用C ++进行真正的功能编程。你所能做的只是大量的痛苦和复杂性(尽管在C ++ 11中它更容易一些)。因此,不建议使用这种方法。 C ++支持其他编程范例相对较好,恕我直言,不应该屈从于它支持较差的范例 - 最终它会使作者只能理解的不可读代码。

Can someone guide me how do functional programming in C++? Is there some good online material that I can refer?

Please note that I know about the library FC++. I want to know how to do that with C++ standard library alone.

Thanks.

解决方案

Update August 2014: This answer was posted in 2009. C++11 improved matters considerably for functional programming in C++, so this answer is no longer accurate. I'm leaving it below for a historical record.

Since this answer stuck as the accepted one - I'm turning it into a community Wiki. Feel free to collaboratively improve it to add real tips on function programming with modern C++.


You can not do true functional programming with C++. All you can do is approximate it with a large amount of pain and complexity (although in C++11 it's a bit easier). Therefore, this approach isn't recommended. C++ supports other programming paradigms relatively well, and IMHO should not be bent to paradigms it supports less well - in the end it will make unreadable code only the author understands.

这篇关于在C ++中进行函数式编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆