2009/6/9 Charles R Harris <charlesr.har...@gmail.com>: >> > - heavily expression-template-based C++, meaning compilation takes >> > ages >> >> No, because _we_ are serious about compilation times, unlike other c++ >> template libraries. But granted, compilation times are not as short as >> a plain C library either. > > I wonder if it is possible to have a compiler/parser that does nothing but > translate templates into c? Say, something written in python ;) Name > mangling would be a problem but could perhaps be simplified for the somewhat > limited space needed for numpy/scipy.
That's not possible: templates are (mostly) the only thing in C++ that can't be translated into C. In a C++ template library, templated types are types that are not determined by the library itself, but will be determined by the application that uses the library. So the template library itself can't be translated into C because there's no way in C to allow "not yet determined" types. In some trivial cases that can be done with macros, but C++ templates go farther than that, they are Turing complete. A C++ type is a tree and using template expressions you can perform any operation on these trees at compilation time. In Eigen, we use these trees to represent arithmetic expressions like "a+b+c". That's the paradigm known as "expression templates". Benoit _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion