Click here to Skip to main content
15,891,372 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: std::mem_fun / std::mem_fun1 / for_each / member functions Pin
valikac10-Mar-06 7:43
valikac10-Mar-06 7:43 
AnswerRe: std::mem_fun / std::mem_fun1 / for_each / member functions Pin
Lim Bio Liong12-Mar-06 6:03
Lim Bio Liong12-Mar-06 6:03 
GeneralRe: std::mem_fun / std::mem_fun1 / for_each / member functions Pin
Malcolm Smart12-Mar-06 6:44
Malcolm Smart12-Mar-06 6:44 
AnswerCurry anyone? Pin
Stephen Hewitt12-Mar-06 18:22
Stephen Hewitt12-Mar-06 18:22 
GeneralMadras Pin
Malcolm Smart12-Mar-06 21:27
Malcolm Smart12-Mar-06 21:27 
GeneralRe: Curry anyone? Pin
Rob Caldecott13-Mar-06 21:15
Rob Caldecott13-Mar-06 21:15 
GeneralRe: Curry anyone? Pin
Stephen Hewitt13-Mar-06 22:00
Stephen Hewitt13-Mar-06 22:00 
GeneralRe: Curry anyone? Pin
Rob Caldecott13-Mar-06 22:35
Rob Caldecott13-Mar-06 22:35 
Steve,

I am actually using Visual Studio 2005 - so have MSC8 (with an STL that I thought was meant to be pretty good!).

Either way - with or without returning something - the code still won't compile.

Here it is in full:

#include "stdafx.h"
#include <windows.h>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>

class CTest
{
public:
	void SomeFunc(const std::wstring& str) const
	{
		OutputDebugString(str.c_str());
		// Some more complicate code goes here
	}

	void DoSomething(void) const
	{
		std::vector<std::wstring> v;
		v.push_back(L"test");
		for_each(v.begin(), v.end(), std::bind1st(std::mem_fun1(&CTest::SomeFunc), this));
	}
};

int _tmain(int argc, _TCHAR* argv[])
{
	CTest test;
	test.DoSomething();
	return 0;
}


When I compile this, I get the following error:

error C2782: 'std::mem_fun1_t<_Result,_Ty,_Arg> std::mem_fun1(_Result (__thiscall _Ty::* )(_Arg))' : template parameter '_Ty' is ambiguous
        c:\program files\microsoft visual studio 8\vc\include\functional(604) : see declaration of 'std::mem_fun1'
        could be 'const CTest'
        or 'CTest'


If I remove 'const' from the two methods, I get lots of different errors. Head meet brick wall. Smile | :)
GeneralBoodt to the recsue! Pin
Rob Caldecott13-Mar-06 22:39
Rob Caldecott13-Mar-06 22:39 
GeneralRe: Boodt to the recsue! Pin
Stephen Hewitt13-Mar-06 22:41
Stephen Hewitt13-Mar-06 22:41 
QuestionPassing information to propretypage Pin
shaohao10-Mar-06 3:20
shaohao10-Mar-06 3:20 
AnswerRe: Passing information to propretypage Pin
Michael Dunn10-Mar-06 6:44
sitebuilderMichael Dunn10-Mar-06 6:44 
QuestionImplementing MDI in an ActiveX control Pin
zulat10-Mar-06 0:02
zulat10-Mar-06 0:02 
Question[Message Deleted] Pin
Igor Mihailov9-Mar-06 10:02
Igor Mihailov9-Mar-06 10:02 
AnswerRe: WTL: Unresolved externals Pin
Jörgen Sigvardsson9-Mar-06 10:33
Jörgen Sigvardsson9-Mar-06 10:33 
GeneralRe: WTL: Unresolved externals Pin
Igor Mihailov9-Mar-06 10:54
Igor Mihailov9-Mar-06 10:54 
QuestionHow to delete/destroy modeless dlg/sheet Pin
shaohao9-Mar-06 4:33
shaohao9-Mar-06 4:33 
AnswerRe: How to delete/destroy modeless dlg/sheet Pin
Justin Tay9-Mar-06 7:28
Justin Tay9-Mar-06 7:28 
GeneralRe: How to delete/destroy modeless dlg/sheet Pin
shaohao10-Mar-06 1:35
shaohao10-Mar-06 1:35 
GeneralRe: How to delete/destroy modeless dlg/sheet Pin
Justin Tay10-Mar-06 1:51
Justin Tay10-Mar-06 1:51 
GeneralPart of ATL not WTL Pin
Justin Tay10-Mar-06 2:04
Justin Tay10-Mar-06 2:04 
GeneralRe: Part of ATL not WTL Pin
shaohao10-Mar-06 2:48
shaohao10-Mar-06 2:48 
AnswerRe: How to delete/destroy modeless dlg/sheet Pin
Michael Dunn9-Mar-06 12:48
sitebuilderMichael Dunn9-Mar-06 12:48 
QuestionIDispEventImpl Pin
QuickDeveloper7-Mar-06 21:32
QuickDeveloper7-Mar-06 21:32 
AnswerRe: IDispEventImpl Pin
Stuart Dootson8-Mar-06 20:53
professionalStuart Dootson8-Mar-06 20:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.