compnerd added a comment. I agree that would be useful. Unfortunately, partial template specialization in this case would be difficult. I would just create a functor that represents the body and is templated on the heap availability. http://reviews.llvm.org/D11897