Best setup for c++ template/generic/metaprogramming
I am writing/maintaining some heavily templated code in c++. I am currently compiling it on windows but it is getting slower to compile and harder to write.
I want to know if there开发者_开发问答 are any
- Tools
- Other Compilers
- Compiler Switch
- IDE
- Practice
- Dependency Management Technique
- Libraries
on Windows/Linux that can help to work on heavily templated code more easily.
i use:
- gcc 4.4/4.5 and/or icc 11.x
-O0 -Wall -g
- emacs (TOO much to say)
- boost mpl/type_traits/fusion/phoenix
boost::mpl::print
is a god's giftBOOST_MPL_ASSERT_MSG
- boost preprocessor: http://www.boostpro.com/mplbook/preprocessor.html
- tyeof/auto: http://www.boost.org/doc/libs/1_45_0/doc/html/typeof.html
- result_of: http://www.boost.org/doc/libs/1_46_0/libs/utility/utility.htm#result_of
If possible, upgrade your compiler. I don't have much experience with Windows, but the upgrade from gcc 4.x to gcc 4.5 is noticeably faster for projects that make heavy use of templates.
Which compiler are you using now? Various compilers have different quality template support and error messages. Clang and Intel tend to be pretty good; GCC usually prints out the necessary information but it is often hard to read. Visual Studio has nice formatting and is fairly compliant. In terms of speed, GCC 4.6 is claimed to be much faster than earlier versions. You might want to download STLfilt to make the errors easier to read. Boost (especially Boost.MPL) is a good library for doing template metaprograms; you might also want Boost.Fusion and/or Boost.Proto depending on what you are doing.
精彩评论