|
Boost : |
Subject: Re: [boost] [signals2] -no instance of overloaded function
From: Tal Agmon (tal.boost_at_[hidden])
Date: 2011-01-28 08:04:54
I guess I should read a bit further ...and use
slot::track_foreign<http://www.boost.org/doc/libs/1_45_0/doc/html/boost/signals2/slot.html#id645761-bb>
(:
On Fri, Jan 28, 2011 at 1:27 PM, Tal Agmon <tal.boost_at_[hidden]> wrote:
> Hi All,
>
>
> I get error no instance of overloading ... when using <memory> shared_ptr
> can anyone explain why?
>
> tested on:
> windows7 vc100
>
>
> // not working
> //#include <memory> // fail to compile
> //using std::tr1::shared_ptr;
> // works
> #include <boost/shared_ptr.hpp> // works find
> using boost::shared_ptr;
>
> [code]
>
> #include <iostream>
> #include <boost/signals2/signal.hpp>
> class Reporter {
> public:
> explicit Reporter(const std::string& s) : s_(s) {}
> void says() const { std::cout<< "news : " << s_ << std::endl; }
> private:
> std::string s_;
> };
>
> class NewsStation{
> public:
> void displayNews(const Reporter& r) const { r.says(); }
> };
>
>
>
> int main()
> {
> using namespace boost::signals2;
> typedef signal<void (const Reporter&) > signal_type;
>
> shared_ptr<signal_type> signalPtr(new signal_type);
> typedef shared_ptr<NewsStation> news_station_ptr;
> Reporter tal("when using std:tr1::shared_ptr --> no instance of
> overloaded function, matches the argument list) ");
> news_station_ptr newsStationPtr(new NewsStation);
>
> signal_type sigNews;
> sigNews.connect( signal_type::slot_type(
> &NewsStation::displayNews, newsStationPtr.get(),
> _1).track(newsStationPtr));
> sigNews(tal);
> }
> [code]
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk