Re: [gtk-list] gtkmm: can't use Signal1<const string>



Christof Petig wrote:
> 
> Hi,
> 
> Guess it - I'm really stress testing gtkmm for my new widget
> (A combo box which fills in idle time, you can give initials. Needed for
> decent database access).
> Soon available under GPL (any interest?) (Not ported to gtk-1.1)
> 
> Now I think I really found a bug! But whether it's the compiler's fault
> or gtkmm's I don't know.
> 
> the appended micro program doesn't compile -
>    class string != class basic_string<char, ...>
> while
>    typedef basic_string<char,...> string
> 
> Really puzzling, isn't it.
> 
>     Christof
> 
>   ------------------------------------------------------------------------
> /*
> g++ -g -Wall -DBE_CAREFUL -DDEBUG -I. -I/usr/local/lib/Gtk--/include -I/usr/local/lib/glib/include -I/usr/local/include -I/usr/X11R6/include   -c sigtest.cc -o sigtest.o
> sigtest.cc: In method 'y::y()':
> sigtest.cc:9: no matching function for call to 'connect_to_method (Signal1<const basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > > &, y *, void (y::*)(string))'
> */
> #include <gtk--sigcpp.h>
> #include <string>
> 
> class y : public Gtk_Signal_Base
> {  Signal1<const string> test;
>  public:
>    void function(const string y);
>    y()
>    {  connect_to_method(test,this,&function);
>    }
> };

Looks like it might be the compiler. This compiled for me with egcs 1.1.

I think the key is to typedef string to a new type and use that in the
signal.

Todd.

--/*
g++ -g -Wall -DBE_CAREFUL -DDEBUG -I. -I/usr/local/lib/Gtk--/include
-I/usr/local/lib/glib/include -I/usr/local/include
-I/usr/X11R6/include   -c sigtest.cc -o sigtest.o
sigtest.cc: In method 'y::y()':
sigtest.cc:9: no matching function for call to 'connect_to_method
(Signal1<const
basic_string<char,string_char_traits<char>,__default_alloc_template<false,0>
> > &, y *, void (y::*)(string))'
*/
#include <gtk--sigcpp.h>
#include <string>

typedef string myString;
#define TypeUsed myString

class y : public Gtk_Signal_Base
{  
  Signal1<TypeUsed> test;
 public:
   void function(TypeUsed y);
   y()
   {  connect_to_method(test,this,&function);
   }
};


 
   ==============================================================
   | Todd Dukes                      E-MAIL:  tdukes@ibmoto.com |
   | Motorola Somerset                  Phone:   (512) 424-8008 |
   | MS OE70                                                    |
   | 6300 Bridgepoint Parkway Building #3                       |
   | Austin, Texas 78730                                        |       
   ==============================================================



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