Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C++x11 is overrated

Name: Anonymous 2013-10-11 16:36

Why do we need it, when even typeof could be implemented using good old turing complete templates?

http://stackoverflow.com/questions/12199280/how-to-implement-boost-typeof
At core, Boost::Typeof uses a sizeof non-evaluated context to convert the type of an expression into an integer, and then converts it back to a type.

Name: Anonymous 2013-10-11 16:39

Because we don't OOP. We have been on this road before.

Name: Anonymous 2013-10-11 16:42

>>2
you can implement haskell in c++, but you cant implement c++ in haskell. prove me rong.

Name: Anonymous 2013-10-11 16:46

Why is typeof necessary when the entire point of object-oriented-privilege is that you needn't delineate between types?

Name: Anonymous 2013-10-11 16:59

>>4
to implement map and fold:
[m]#define map(X,Xs,Body) ({ \
__typeof__(Xs[0]) X; \
__typeof__(Body) YValue; \
vector<__typeof__(YValue)> Ys; \
int K; \
for(K=0; K<Xs.size(); K++) { \
X = Xs[K]; \
Ys.push_back(Body); \
} \
Ys; \
})

#define let(A,B) __typeof__(B) A = B

int main() {
vector<int> Xs;
Xs.push_back(1);
Xs.push_back(2);
Xs.push_back(3);
Xs.push_back(4);
let(Ys, map(X,Xs,(double)(X*X)));
for (int I = 0; I < Ys.size(); I++) {
printf("%f\n", Ys[I]);
}
return 0;
}[/m]

Name: Anonymous 2013-10-11 17:01

>>3
Haha, you'd just assign a variable and HASKALL would break.

Don't change these.
Name: Email:
Entire Thread Thread List