True GoL using only metaprogramming in C++11
Usage:
- edit 'dimension', 'iteration' and 'start' constants appropriately
- compile
- if your compiler was able to do it - you'll get the fastest implementatation of GoL available :)
True GoL using only metaprogramming in C++
[eugene@book tests]$ g++ -std=c++11 -c main.cpp
main.cpp:161:33: error: non-template 'next_point_state' used as template
using point = level::next_point_state;
^
main.cpp:161:33: note: use 'level<initial_state>::template next_point_state' to indicate that it is a template
main.cpp:161:19: error: need 'typename' before 'level<initial_state>::next_point_state' because 'level<initial_state>' is a dependent scope
using point = level::next_point_state;
^
main.cpp:164:44: error: 'point' was not declared in this scope
tuple< point<point_count - iter> >,
^
main.cpp:164:68: error: template argument 1 is invalid
tuple< point<point_count - iter> >,
^
main.cpp:164:70: error: wrong number of template arguments (1, should be 2)
tuple< point<point_count - iter> >,
^
main.cpp:151:8: note: provided for 'template<class tuple_1, class tuple_2> struct my_tuple_cat'
struct my_tuple_cat
^
main.cpp:163:33: error: expected nested-name-specifier
using next_field = typename my_tuple_cat <
^
main.cpp:173:33: error: non-template 'next_point_state' used as template
using point = level::next_point_state;
^
main.cpp:173:33: note: use 'level<initial_state>::template next_point_state' to indicate that it is a template
main.cpp:173:19: error: need 'typename' before 'level<initial_state>::next_point_state' because 'level<initial_state>' is a dependent scope
using point = level::next_point_state;
^
main.cpp:175:31: error: 'point' was not declared in this scope
using next_field = tuple< point<point_count - 1> >;
^
main.cpp:175:52: error: template argument 1 is invalid
using next_field = tuple< point<point_count - 1> >;
^
main.cpp: In instantiation of 'static void game_process<field, iters>::print() [with field = std::tuple<O, O, O, O, O, O, O, X, O, O, O, O, O, X, O, O, X, X, X, O, O, O, O, O, O>; int iters = 20]':
main.cpp:202:40: required from here
main.cpp:186:98: error: no type named 'next_field' in 'struct next_field_state<std::tuple<O, O, O, O, O, O, O, X, O, O, O, O, O, X, O, O, X, X, X, O, O, O, O, O, O>, 25>'
game_process< typename next_field_state<field, point_count>::next_field, iters-1 >::print();
It's time to rewrite the game with C++14. :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.