在C ++中进行函数式编程 [英] Functional Programming in C++
问题描述
请注意,我知道库FC ++。我想知道如何单独使用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屋!