Boost logo

Boost :

Subject: [boost] Visual Studio 2010 Template Limits
From: Daniel Larimer (dlarimer_at_[hidden])
Date: 2010-05-12 10:05:02


I have written some code that makes heavy use of templates and which
compiles just fine using g++; however, when I recently tried to compile the
code in VC++ 2010 I got a fatal error C1063: compiler limit : compiler stack
overflow.

It directs me to this template...
 See reference to class template instantiation
'delegate<T1>::overloads<1,S0,ptr0>' being compiled

The general code structure is...

template<T1>
class delegate
{
    template<typename RTN, typename TY PARAM_TNS, RTN
(TY::*m_ptr)(PARAM_PTS)> class method_impl<RTN (TY::*)(PARAM_PTS), m_ptr>
: public method;

    // specialized for n with BOOST_PP_ITERATE (blows up even if n == 1)
    template<int, typename S0, S0 ptr0> class overloads<n, PARAM_TYPES>
: public method_impl<S0,ptr0>, public method_impl<S1,ptr1> ... {
    };
};

I don¹t even need to instantiate delegate<ForSomeType>, simply including the
header causes it to blow up.

Considering the extent to which boost uses and ³abuses² templates I thought
I would ask whether anyone here knows of some limitation or constructs which
I must avoid? Is there some way to increase the ³stack² for VC++¹s CL
program?

Dan




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk