RE: VSE10 and GTKmm 2.22



There are indeed several problems with the code, not the least of which is that you are returning a reference to a stack-created temporary object, which is extremely likely to explode in your face at some point.

 

This would be a more correct version of the function:

 

template<typename T>

std::string toString(const T& data)

{

ÂÂÂ std::ostringstream num;

ÂÂÂ num << data;

ÂÂ return num.str();

}

 

From: gtkmm-list [mailto:gtkmm-list-bounces gnome org] On Behalf Of Doesnt Stop
Sent: Wednesday, 13 February 2013 10:27
To: Gtkmm List
Subject: VSE10 and GTKmm 2.22

 

There is no problem with the code.
#include <iostream>

1. template< typename T>
2. std::string& toString(const T& data){
3.   std::stringstream num(std::stringstream::out);
4.   num << data;
5.   return run.c_str();
6. }

However, an error is triggered by line 3. This error started happening as soon as I

added the GTKmm property sheet. If I remove the property sheet from the project, then

the applicatin compiles without any problem.
So, the problem is the gtkmm and not VC++ or the IDE in my Win7.
Is there anyone here having the same problem?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]