Boost logo

Boost Users :

From: dick.bridges_at_[hidden]
Date: 2002-09-26 12:02:39


Thanks. I changed the map to:
      typedef map<session_id, boost::function<long, Y*, X*> > MyMessageMap;

No errors but enough warnings to choke a horse. Have I just been nailed by
VC6SP4? If so, I think I'll just give up and map the session-ids to Y*s.
%>(

Thanks in advance for any suggestions.

<warnings>
--------------------Configuration: MyProject - Win32
Debug--------------------
Compiling...
Z.cpp
c:\boost\function.hpp(451) : warning C4097: typedef-name 'base_type' used
as synonym for class-name
'function<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>::function1<R,T0,
`template-parameter268',`template-parameter269',`template-parameter270'>'
        c:\boost\function.hpp(497) : see reference to class template
instantiation 'boost::function<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>' being
compiled
c:\boost\function.hpp(452) : warning C4097: typedef-name 'base_type' used
as synonym for class-name
'function<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>::function1<R,T0,
`template-parameter268',`template-parameter269',`template-parameter270'>'
        c:\boost\function.hpp(497) : see reference to class template
instantiation 'boost::function<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>' being
compiled
c:\boost\function.hpp(453) : warning C4097: typedef-name 'base_type' used
as synonym for class-name
'function<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>::function1<R,T0,
`template-parameter268',`template-parameter269',`template-parameter270'>'
        c:\boost\function.hpp(497) : see reference to class template
instantiation 'boost::function<R,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>' being
compiled
c:\boost\function.hpp(451) : warning C4097: typedef-name 'base_type' used
as synonym for class-name 'function<int,class Y *,class X *,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,st
ruct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable>::fun
ction2<int,class Y *,class X *,struct boost::empty_function_policy,struct
boost::empty_function_mixin,class std::allocator<class
boost::function_base> >'
        c:\program files\microsoft visual studio\vc98\include\utility(26) :
see reference to class template instantiation 'boost::function<int,class Y
*,class X *,struct boost::detail::function::unusable,struct
boost::detail::fu
nction::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::funct
ion::unusable>' being compiled
        c:\program files\microsoft visual studio\vc98\include\xtree(28) :
see reference to class template instantiation 'std::pair<class session_id
const ,class boost::function<int,class Y *,class X *,struct boost::detail::
function::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::fun
ction::unusable,struct boost::detail::function::unusable> >' being compiled
        c:\program files\microsoft visual studio\vc98\include\map(46) : see
reference to class template instantiation 'std::_Tree<class
session_id,struct std::pair<class session_id const ,class
boost::function<int,class Y *,c
lass X *,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::functi
on::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable> >,struct std::map<class session_id,class
boost::function<int,class Y *,class X *,struct
boost::detail::function::unusable,struc
t boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct b
oost::detail::function::unusable>,struct std::less<class session_id>,class
std::allocator<class boost::function<int,class Y *,class X *,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struc
t boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::unusable>
> >::_K
fn,struct std::less<class session_id>,class std::allocator<class
boost::function<int,class Y *,class X *,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::unus
able,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::unusable>
> >' being compiled
        c:\src\inc\Z.h(240) : see reference to class template instantiation
'std::map<class session_id,class boost::function<int,class Y *,class X
*,struct boost::detail::function
::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::u
nusable,struct boost::detail::function::unusable>,struct std::less<class
session_id>,class std::allocator<class boost::function<int,class Y *,class
X *,struct boost::detail::function::unusable,struct boost::detail::function
::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::u
nusable> > >' being compiled
c:\boost\function.hpp(452) : warning C4097: typedef-name 'base_type' used
as synonym for class-name 'function<int,class Y *,class X *,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,st
ruct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable>::fun
ction2<int,class Y *,class X *,struct boost::empty_function_policy,struct
boost::empty_function_mixin,class std::allocator<class
boost::function_base> >'
        c:\program files\microsoft visual studio\vc98\include\utility(26) :
see reference to class template instantiation 'boost::function<int,class Y
*,class X *,struct boost::detail::function::unusable,struct
boost::detail::fu
nction::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::funct
ion::unusable>' being compiled
        c:\program files\microsoft visual studio\vc98\include\xtree(28) :
see reference to class template instantiation 'std::pair<class session_id
const ,class boost::function<int,class Y *,class X *,struct boost::detail::
function::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::fun
ction::unusable,struct boost::detail::function::unusable> >' being compiled
        c:\program files\microsoft visual studio\vc98\include\map(46) : see
reference to class template instantiation 'std::_Tree<class
session_id,struct std::pair<class session_id const ,class
boost::function<int,class Y *,c
lass X *,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::functi
on::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable> >,struct std::map<class session_id,class
boost::function<int,class Y *,class X *,struct
boost::detail::function::unusable,struc
t boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct b
oost::detail::function::unusable>,struct std::less<class session_id>,class
std::allocator<class boost::function<int,class Y *,class X *,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struc
t boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::unusable>
> >::_K
fn,struct std::less<class session_id>,class std::allocator<class
boost::function<int,class Y *,class X *,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::unus
able,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::unusable>
> >' being compiled
        c:\src\inc\Z.h(240) : see reference to class template instantiation
'std::map<class session_id,class boost::function<int,class Y *,class X
*,struct boost::detail::function
::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::u
nusable,struct boost::detail::function::unusable>,struct std::less<class
session_id>,class std::allocator<class boost::function<int,class Y *,class
X *,struct boost::detail::function::unusable,struct boost::detail::function
::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::u
nusable> > >' being compiled
c:\boost\function.hpp(453) : warning C4097: typedef-name 'base_type' used
as synonym for class-name 'function<int,class Y *,class X *,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,st
ruct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable>::fun
ction2<int,class Y *,class X *,struct boost::empty_function_policy,struct
boost::empty_function_mixin,class std::allocator<class
boost::function_base> >'
        c:\program files\microsoft visual studio\vc98\include\utility(26) :
see reference to class template instantiation 'boost::function<int,class Y
*,class X *,struct boost::detail::function::unusable,struct
boost::detail::fu
nction::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::funct
ion::unusable>' being compiled
        c:\program files\microsoft visual studio\vc98\include\xtree(28) :
see reference to class template instantiation 'std::pair<class session_id
const ,class boost::function<int,class Y *,class X *,struct boost::detail::
function::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::fun
ction::unusable,struct boost::detail::function::unusable> >' being compiled
        c:\program files\microsoft visual studio\vc98\include\map(46) : see
reference to class template instantiation 'std::_Tree<class
session_id,struct std::pair<class session_id const ,class
boost::function<int,class Y *,c
lass X *,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::functi
on::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable> >,struct std::map<class session_id,class
boost::function<int,class Y *,class X *,struct
boost::detail::function::unusable,struc
t boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct b
oost::detail::function::unusable>,struct std::less<class session_id>,class
std::allocator<class boost::function<int,class Y *,class X *,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struc
t boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::unusable>
> >::_K
fn,struct std::less<class session_id>,class std::allocator<class
boost::function<int,class Y *,class X *,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::unus
able,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::unusable>
> >' being compiled
        c:\src\inc\Z.h(240) : see reference to class template instantiation
'std::map<class session_id,class boost::function<int,class Y *,class X
*,struct boost::detail::function
::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::u
nusable,struct boost::detail::function::unusable>,struct std::less<class
session_id>,class std::allocator<class boost::function<int,class Y *,class
X *,struct boost::detail::function::unusable,struct boost::detail::function
::unusable,struct boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct
boost::detail::function::unusable,struct boost::detail::function::u
nusable> > >' being compiled

Z.obj - 0 error(s), 6 warning(s)
</warnings>

                                                                                                                                      
                      Tom Matelich
                      <tmatelich_at_zetec To: "'Boost-Users_at_[hidden]'" <Boost-Users_at_[hidden]>
                      .com> cc:
                                               Subject: RE: [Boost-Users] bind: I just keep trying...
                      09/26/2002 08:40
                      AM
                      Please respond
                      to Boost-Users
                                                                                                                                      
                                                                                                                                      

I think the best solution for you would be to put boost::function<short>'s
in your map. Look at the example in the bind documentation at
http://www.boost.org/libs/bind/bind.html#with_boost_function

Tom

> -----Original Message-----
> From: dick.bridges_at_[hidden] [mailto:dick.bridges_at_[hidden]]
> Sent: Thursday, September 26, 2002 7:57 AM
> To: Boost-Users_at_[hidden]
> Subject: RE: [Boost-Users] bind: I just keep trying...
>
>
>
> I'm trying to store member function pointers. For purposes of this
> discussion, the key is an int.
>
> <context>
> X is the virtual base class for polymorphic message classes.
> all messages have a session-d attribute
>
> Ys are instances of classes derived from a virtual message hanler base
> class.
> foo() is the message handler function.
>
> Z is the 'message pump' that dispatches messages to Ys based upon the
> session-id.
>
> Y instances insert make_pair(session-id, message_handler)
> pairs into the
> map.
> (I think _1 is 'this' during the insert.)
>
> Z calls the Y instance message-handler using the session-id
> key to the
> map.
> </context>
>
>
>
>
>
>
> Mark Storer
>
>
> <mstorer_at_cardiff To:
> "'Boost-Users_at_[hidden]'" <Boost-Users_at_[hidden]>
>
> .com> cc:
>
>
> Subject: RE:
> [Boost-Users] bind: I just keep trying...
>
> 09/25/2002 04:47
>
>
> PM
>
>
> Please respond
>
>
> to Boost-Users
>
>
>
>
>
>
>
>
>
>
>
>
> I'm a little confused as to what you're aiming for here... a
> map of ints to
> function pointers (that can point to Y::foo)?
>
> This should do the trick, provided I'm recalling my function pointer
> declarations correctly
> std::map<int, short()(*X)>
>
> Further boost::bind creates an INSTANCE of a functor. Giving
> the compiler
> an instance when it wants a type is not a good way to keep it happy.
>
> Now if what you're actually after is calling Y::foo on a
> colleciton of Y's,
> then you don't need a collection of function pointers for
> each instance in
> the first place, which is where bind comes in. According to my flimsy
> understanding of bind (I haven't used it yet), this should do
> the trick:
>
> X someX;
> std::vector<Y> &wise = BuildYs(); // wise == plural of Y
>
> std::for_each(
> wise.begin(),
> wise.end(),
> boost::bind<short>(&Y::foo, &someX)
> );
>
> If you want the X parameter to vary from one call of foo to
> the next, I
> suggest rolling your own loop... or incorporating the X* into
> Y, at which
> point you can get rid of the X* parameter, and use
> boost::bind(&Y::foo), or
> std::mem_fun(&Y::foo).
>
> --Mark Storer
> Software Engineer
> Cardiff Software
>
> #include <disclaimer>
> typedef std::disclaimer<Cardiff> Discard;
>
>
> -----Original Message-----
> From: dick.bridges_at_[hidden] [mailto:dick.bridges_at_[hidden]]
> Sent: Wednesday, September 25, 2002 4:08 PM
> To: boost-users_at_[hidden]
> Subject: [Boost-Users] bind: I just keep trying...
>
>
> Everytime I think I have a clue, I'm reminded how little I REALLY
> understand.
>
> <error compiler='VC6SP4'>
> 'map' : invalid template argument for '_Ty', type expected
> </error>
>
> <snippet>
> struct X
> {
> }
>
> struct Y
> {
> short foo(X*);
> }
>
> struct Z
> {
> map<int, bind(&Y::foo, _1, _2) > myMap;
> }
> </snippet>
>
> I thought I saw how to do this somewhere on the website but I
> sure can't
> find it now. Any help GREATFULLY appreciated.
>
>
>
> Info: <http://www.boost.org>
> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
> Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
> Info: <http://www.boost.org>
> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
> Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> ---------------------~-->
> Home Selling? Try Us!
> http://us.click.yahoo.com/QrPZMC/iTmEAA/MVfIAA/EbFolB/TM
> --------------------------------------------------------------
> -------~->
>
> Info: <http://www.boost.org>
> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
> Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>

-----------------------------------------------------------------------
DISCLAIMER: Information contained in this message and/or
attachment(s) may contain confidential information of Zetec, Inc.
If you have received this transmission in error, please notify
the sender by return email.
-----------------------------------------------------------------------

Info: <http://www.boost.org>
Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


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