|
Boost Users : |
From: Christian Henning (chhenning_at_[hidden])
Date: 2007-05-20 16:59:15
Ovanes, I know about the /ZmXXX compiler option. Usually the compiler
will report when it's running out of heap space. But in this case the
compiler just crashes.
This is very simple example that crashes the compiler.
#include <iostream>
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>
void print( const std::string* s )
{
std::cout << s;
}
int main ( int, char** )
{
typedef boost::shared_ptr<std::string> string_ptr_t;
typedef std::vector < string_ptr_t > vec_t;
vec_t data;
// this works
boost::bind( &print
, boost::bind( &string_ptr_t::get
, string_ptr_t( new std::string( "Hello" ))))();
// this doesn't work - ICE
std::for_each ( data.begin(),
data.end(),
boost::bind( &print
, boost::bind( &string_ptr_t::get
, boost::bind::_1 )));
return 0;
}
On 5/20/07, Ovanes Markarian <om_boost_at_[hidden]> wrote:
> Christian,
>
> Can you please specify what happens when the compiler crashes? There is a
> known issue that template intensive code can crash the VC compiler, to
> resolve it, you can increase the memory heap size used by VC internally. You
> may read more on it at:
>
> http://www.boost.org/doc/html/variant/misc.html#variant.troubleshooting
>
> This is not only boost::variant issue and can happen in other libraries as
> well.
>
>
> Best Regards,
> Ovanes
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Christian Henning [mailto:chhenning_at_[hidden]]
> Gesendet: Sonntag, 20. Mai 2007 00:41
> An: boost-users_at_[hidden]
> Betreff: Re: [Boost-users] Converting loop to using boost::lambda where
> containers has boost::shared_ptrs
>
> >
> > I am glad to know I still the have skill of breaking compilers. :)
> >
> Well, I seem to have similar skills. The code below crashes my
> compiler ( VC7.1 SP 1), as well.
>
>
> void print( const std::string& s )
> {
> std::cout << s;
> }
>
> int main ( int, char** )
> {
> typedef boost::shared_ptr<A> A_ptr_t;
> typedef boost::shared_ptr<D> D_ptr_t;
>
> typedef std::vector < boost::shared_ptr<Base> > Data_t;
> Data_t m_data;
>
> A_ptr_t a ( new A ( 50 ) );
> D_ptr_t d ( new D ( 30 ) );
>
> m_data.push_back ( a );
> m_data.push_back ( d );
>
> boost::uint32_t indent_value = 4;
>
> // this works
> boost::bind( &print
> , boost::bind( &Base::to_String
> , A_ptr_t( new A( 5 ) )
> , indent_value ))();
>
> // this doesn't work - ICE
> std::for_each ( m_data.begin(),
> m_data.end(),
> boost::bind( &print
> , boost::bind( &Base::to_String
> , boost::bind::_1
> , indent_value )));
>
> return 0;
> }
>
> I know this is not the solution. I'm still using a seperate function
> print() for outputting. I will keep trying to solve that one.
>
> On the other hand it would be nice if boost::bind comes some handy
> function like the print(). Just a thought.
>
> Christian
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net