Istvan Buki writes:
I modified my sample code to take advantage of your suggestion to calculate the index at compile time. It works perfectly well and the code generated is faster than my previous version but I still have questions:
1) I'm not sure if this is the right place to ask, if not somebody will certainly be able to point me into the right direction. In the assembly code generated (file attached to this mail), there are two 'call' instructions that seem useless to me. Why not inline the single 'movl' instruction executed as the result of the call? I'm using g++ 3.3.3 with O2 optimization flag and it is probably a very compiler-specific question but perhaps I'm missing something obvious here.
2) By now you probably guessed that my goal is to produce code for embedded use. In this environment standard libraries would not be available. Could you give me some idea how hard it would be to modify the mpl library not to rely on any standard include and lib?
Should be trivial -- the library has very little dependencies on the standard headers. In fact, 'std::size_t' and LONG_MAX are likely to be the only ones. You'd need to replace the default Boost config headers with your own, though, because those do depend on the presence of various std headers. Please see http://www.boost.org/libs/config/config.htm#advanced_config for the instructions on how to do that. HTH, -- Aleksey Gurtovoy MetaCommunications Engineering