Click here to Skip to main content
15,892,737 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ classes help please Pin
jhwurmbach9-Mar-08 23:25
jhwurmbach9-Mar-08 23:25 
GeneralDLL C/C++ structure export import mismatch Pin
ForNow9-Mar-08 16:33
ForNow9-Mar-08 16:33 
GeneralRe: DLL C/C++ structure export import mismatch Pin
Blake Miller11-Mar-08 11:01
Blake Miller11-Mar-08 11:01 
GeneralRe: DLL C/C++ structure export import mismatch Pin
ForNow11-Mar-08 18:16
ForNow11-Mar-08 18:16 
GeneralSorry !! Pin
ForNow11-Mar-08 18:48
ForNow11-Mar-08 18:48 
GeneralHow about using extern "C" for "C" ALIGNMENT INSTEAD OF C ++ ALIGNMENT Pin
ForNow12-Mar-08 0:01
ForNow12-Mar-08 0:01 
GeneralRe: DLL C/C++ structure export import mismatch Pin
ForNow11-Mar-08 13:05
ForNow11-Mar-08 13:05 
QuestionBjarne's member function binding sample is wrong? Pin
George_George9-Mar-08 16:32
George_George9-Mar-08 16:32 
Hello everyone,


Here is the quoted section, words from Bjarne and his sample. The reason why I think the sample is wrong, is because, the member function sort accepts empty arguments, so when we call ::sort (v), only the one in global namespace will be matched -- there is no ambiguity to call sort member function of Container from parameter list comparison. I do not know why Bjarne commets "sort (vector<T>&) which calls std::sort() rather than Container::sort()" -- I think it has nothing to do with template -- just a normal function call matching.

Any comments? Do you agree with me and think his sample is wrong?

section 13.8.3 Point of Instantiation Binding

--------------------
unqualified name can not be bound to members of that class
--------------------

template <class T> void sort (vector<T>& v)
{
	sort (v.begin(), v.end());
}

class Container {
	vector<int> v; // elements
public:
	void sort() // sort elements
	{
		::sort (v); // sort (vector<T>&) which calls std::sort() rather than Container::sort()
	}
};



thanks in advance,
George
AnswerRe: Bjarne's member function binding sample is wrong? Pin
Rajkumar R9-Mar-08 20:47
Rajkumar R9-Mar-08 20:47 
GeneralRe: Bjarne's member function binding sample is wrong? Pin
George_George9-Mar-08 22:30
George_George9-Mar-08 22:30 
AnswerRe: Bjarne's member function binding sample is wrong? Pin
Maxwell Chen9-Mar-08 22:52
Maxwell Chen9-Mar-08 22:52 
GeneralRe: Bjarne's member function binding sample is wrong? Pin
George_George9-Mar-08 23:48
George_George9-Mar-08 23:48 
AnswerRe: Bjarne's member function binding sample is wrong? [modified] Pin
Maxwell Chen10-Mar-08 1:11
Maxwell Chen10-Mar-08 1:11 
GeneralRe: Bjarne's member function binding sample is wrong? Pin
George_George10-Mar-08 2:29
George_George10-Mar-08 2:29 
GeneralRe: Bjarne's member function binding sample is wrong? Pin
Maxwell Chen10-Mar-08 4:28
Maxwell Chen10-Mar-08 4:28 
GeneralRe: Bjarne's member function binding sample is wrong? Pin
George_George10-Mar-08 19:05
George_George10-Mar-08 19:05 
AnswerRe: Bjarne's member function binding sample is wrong? Pin
David Crow10-Mar-08 3:34
David Crow10-Mar-08 3:34 
GeneralRe: Bjarne's member function binding sample is wrong? Pin
George_George10-Mar-08 3:43
George_George10-Mar-08 3:43 
Generalnon-dependent name in template function Pin
George_George9-Mar-08 16:10
George_George9-Mar-08 16:10 
GeneralVC++ MFC - getting started Pin
Fred Andres9-Mar-08 14:35
Fred Andres9-Mar-08 14:35 
GeneralRe: VC++ MFC - getting started Pin
Christian Graus9-Mar-08 19:45
protectorChristian Graus9-Mar-08 19:45 
GeneralRe: VC++ MFC - getting started Pin
David Crow10-Mar-08 3:43
David Crow10-Mar-08 3:43 
Questionvector.push_back, item disappears [modified] Pin
Anthony Mushrow9-Mar-08 14:26
professionalAnthony Mushrow9-Mar-08 14:26 
GeneralRe: vector.push_back, item disappears Pin
Mark Salsbery9-Mar-08 14:42
Mark Salsbery9-Mar-08 14:42 
GeneralRe: vector.push_back, item disappears Pin
Anthony Mushrow9-Mar-08 14:56
professionalAnthony Mushrow9-Mar-08 14:56 

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.