Article View: pl.comp.lang.funkcyjne
Article #870Biblioteka boost::bind i uruchamianie konstruktorów z argumentami
From: tytan15
Date: Mon, 26 Feb 2007 18:35
Date: Mon, 26 Feb 2007 18:35
18 lines
1467 bytes
1467 bytes
Mamy oto kod poniżej,
chcę by został uruchamiany konstruktor tytan(int,int)w klasie tytan w
szablonie boost::bind i nowoutworzony obiekt był zwracany to zmiennej c
typu tytan;
Proszę mnie nie pytać o zasadność takiego pytania,tylko jak da sie to zrobić
by niżej podany przykład kompilował się.
#include <boost/bind.hpp>
class tytan
{
tytan(int,int){};
};
int main()
{
tytan c=(boost::bind(&tytan,_1,_2))(1,2);//odpowiednik tytan c(1,2);
}
Kompilator wywala mnie następujace błędy:
stream.cpp: In function 'int main()':
stream.cpp:8: error: expected primary-expression before ',' token
Technical Details
Message-ID:
<erv9c5$k1v$2@news.onet.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news2.icm.edu.pl!news.onet.pl!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news2.icm.edu.pl!news.onet.pl!not-for-mail From: "tytan15@poczta.onet.pl" <tytan15@poczta.onet.pl> Newsgroups: pl.comp.lang.c,pl.comp.lang.funkcyjne Subject: Biblioteka boost::bind i uruchamianie konstruktorów z argumentami Supersedes: <erv991$k1v$1@news.onet.pl> Followup-To: pl.comp.lang.c Date: Mon, 26 Feb 2007 19:35:41 +0100 Organization: Onet.pl Lines: 20 Message-ID: <erv9c5$k1v$2@news.onet.pl> NNTP-Posting-Host: bus178.internetdsl.tpnet.pl Mime-Version: 1.0 X-Trace: news.onet.pl 1172515014 20543 83.18.174.178 (26 Feb 2007 18:36:54 GMT) X-Complaints-To: usenet@news.onet.pl NNTP-Posting-Date: Mon, 26 Feb 2007 18:36:54 +0000 (UTC) X-Sender: D9kyzi+Zr8E7LEDWBZNKow== User-Agent: KNode/0.10.4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit