FC++;与g+合作+;4.5.0? Fc++是C++中函数编程的一个库。我在MinGW和gcc4.5.0上使用它。当我使用更基本的功能时,我没有问题。但是一个更高级的特性是给了我一个与模板相关的错误(或者可能只是我的代码有问题……不可能!)
有没有人让FC++使用4.5.0?看到我的代码有什么问题吗 虽然它显示了gcc和模板专门化的问题历史,但它已经完全过时了。这本书并不是最新的 这是我的密码:FC++;与g+合作+;4.5.0? Fc++是C++中函数编程的一个库。我在MinGW和gcc4.5.0上使用它。当我使用更基本的功能时,我没有问题。但是一个更高级的特性是给了我一个与模板相关的错误(或者可能只是我的代码有问题……不可能!),c++,gcc,functional-programming,C++,Gcc,Functional Programming,有没有人让FC++使用4.5.0?看到我的代码有什么问题吗 虽然它显示了gcc和模板专门化的问题历史,但它已经完全过时了。这本书并不是最新的 这是我的密码: #include <iostream> #include "prelude.h" using namespace fcpp; using namespace std; struct TwoTimes { template <class T> struct Sig : public FunTy
#include <iostream>
#include "prelude.h"
using namespace fcpp;
using namespace std;
struct TwoTimes {
template <class T>
struct Sig : public FunType<T,T> {};
template <class F>
F operator() (const F& x) const { return 2*x; };
} twoTimes;
int main(int argc, char* argv[] )
{
cout << compose(twoTimes,twoTimes)(3) << endl;
return 0;
}
#包括
#包括“前奏曲h”
使用名称空间fcpp;
使用名称空间std;
结构两次{
模板
struct Sig:public FunType{};
模板
F运算符()(常数F&x)常数{return 2*x;};
}两次;
int main(int argc,char*argv[])
{
好吧……你提到的链接已经有七年历史了。在狗年和编译年,这是一个美好的一生
如果您希望使用(当前)进行函数式编程C++编译器,也许有些库可能是有意思的。 如果需要这个答案,结构体需要打包到Fc++中。我已经用FC++多了几年了。我能做的最好的事情就是在这里讨论C2 wiki,我在这里讨论过:
任何张贴在那里,我会看到
In file included from full.h:14:0,
from lambda.h:38,
from operator.h:29,
from function.h:23,
from reuse.h:14,
from list.h:31,
from prelude.h:32,
from y.cxx:2:
smart.h: In instantiation of 'fcpp::FunctoidTraits<TwoTimes>':
prelude.h:142:74: instantiated from 'fcpp::impl::XCompose::Sig<TwoTimes, TwoTimes>'
full.h:94:53: instantiated from 'fcpp::Full2<fcpp::impl::XCompose>::Sig<TwoTimes, TwoTimes>'
y.cxx:18:46: instantiated from here
smart.h:103:7: error: no type named 'Type' in 'struct
fcpp::impl::NeededASmartFunctoidButInsteadGot<TwoTimes, false>'
In file included from y.cxx:2:0:
prelude.h: In instantiation of 'fcpp::impl::XCompose::Sig<TwoTimes, TwoTimes>':
full.h:94:53: instantiated from 'fcpp::Full2<fcpp::impl::XCompose>::Sig<TwoTimes, TwoTimes>'
y.cxx:18:46: instantiated from here
prelude.h:142:74: error: 'fcpp::FunctoidTraits<TwoTimes>::max_args' is not a valid
template argument for type 'int' because it is a non-constant expression
In file included from lambda.h:38:0,
from operator.h:29,
from function.h:23,
from reuse.h:14,
from list.h:31,
from prelude.h:32,
from y.cxx:2:
full.h: In instantiation of 'fcpp::Full2<fcpp::impl::XCompose>::Sig<TwoTimes, TwoTimes>':
y.cxx:18:46:
instantiated from here
full.h:94:53: error: no type named 'Arg1Type' in 'struct
fcpp::impl::XCompose::Sig<TwoTimes, TwoTimes>'
y.cxx: In function 'int main(int, char**)':
y.cxx:18:46: error: no match for call to '(fcpp::Compose) (TwoTimes&, TwoTimes&)'