Click here to Skip to main content
16,010,544 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralCWebBrowser problem Pin
dorutzu25-Sep-03 3:37
dorutzu25-Sep-03 3:37 
GeneralRe: CWebBrowser problem Pin
Bernhard25-Sep-03 4:08
Bernhard25-Sep-03 4:08 
GeneralRe: CWebBrowser problem Pin
dorutzu25-Sep-03 4:44
dorutzu25-Sep-03 4:44 
GeneralRe: CWebBrowser problem Pin
Michael Dunn25-Sep-03 4:56
sitebuilderMichael Dunn25-Sep-03 4:56 
GeneralGetActiveObject Pin
Member 60189825-Sep-03 2:18
Member 60189825-Sep-03 2:18 
GeneralRe: GetActiveObject Pin
Abhishek Srivastava19-Oct-03 23:33
Abhishek Srivastava19-Oct-03 23:33 
GeneralRe: GetActiveObject Pin
Member 60189820-Oct-03 0:40
Member 60189820-Oct-03 0:40 
GeneralTemplate question... Pin
Bernhard25-Sep-03 2:12
Bernhard25-Sep-03 2:12 
Hello,

because of the tip "Consider replacing associative containers with sorted vectors" from the book "Effective STL" (and because it did work out better in my project) i did replace a map with a vector<pair<...>>
to compare the data i used the CompareData class presented in the book - to make the sorted vector act like a map.
Works out great.
I just wanted to make a templated Version of this.. and strangely it doesn't work out..

anybody any ideas ?
// The Original Code: this works
        typedef std::pair<int, int>Data;
	class DataCompare
	{
	public:
		bool operator () (const Data& lhs, const Data& rhs) const
		{
			return keyLess (lhs.first, rhs.first);
		}
		
		bool operator () (const Data& lhs, const Data::first_type& k) const
		{
			return keyLess (lhs.first, k);
		}
		
		bool operator () (const Data::first_type& k, const Data& rhs) const
		{
			return keyLess (k, rhs.first);
		}
	private:
		bool keyLess (const Data::first_type& k1, const Data::first_type& k2) const
		{
			return k1 < k2;
		}
	};

//The template Code this doesn't work it says that no operator () is provided
template <typename T1, typename T2>
class _DataCompare
{
public:
	bool operator () (const std::pair<T1,T2>& lhs, const std::pair<T1,T2>& rhs) const
	{
		return keyLess (lhs.first, rhs.first);
	}
	
	bool operator () (const std::pair<T1,T2>& lhs, const std::pair<T1,T2>::first_type& k) const
	{
		return keyLess (lhs.first, k);
	}
	
	bool operator () (const std::pair<T1,T2>::first_type& k, const std::pair<T1,T2>& rhs) const
	{
		return keyLess (k, rhs.first);
	}
private:
	bool keyLess (const std::pair<T1,T2>::first_type& k1, const std::pair<T1,T2>::first_type& k2) const
	{
		return k1 < k2
	}
};

_DataCompare<int, int> DataCompare;




"I'm from the South Bronx, and I don't care what you say: those cows look dangerous."
U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
GeneralRe: Template question... Pin
Joaquín M López Muñoz25-Sep-03 3:31
Joaquín M López Muñoz25-Sep-03 3:31 
GeneralRe: Template question... Pin
Bernhard25-Sep-03 3:34
Bernhard25-Sep-03 3:34 
GeneralRe: Template question... Pin
Joaquín M López Muñoz25-Sep-03 3:39
Joaquín M López Muñoz25-Sep-03 3:39 
GeneralRe: Template question... Pin
Bernhard25-Sep-03 4:05
Bernhard25-Sep-03 4:05 
GeneralAbout the messagebox in activex control Pin
Foxray24-Sep-03 0:19
Foxray24-Sep-03 0:19 
GeneralATL from VC7 into VC6 Pin
Jeremy Pullicino23-Sep-03 22:53
Jeremy Pullicino23-Sep-03 22:53 
GeneralRe: ATL from VC7 into VC6 Pin
Steve S24-Sep-03 2:58
Steve S24-Sep-03 2:58 
GeneralRe: ATL from VC7 into VC6 Pin
Amit Dey30-Sep-03 10:36
Amit Dey30-Sep-03 10:36 
Generalget IUnknown from window handle Pin
Member 60189823-Sep-03 21:46
Member 60189823-Sep-03 21:46 
GeneralSmart Pointers Pin
qur23-Sep-03 4:55
qur23-Sep-03 4:55 
GeneralRe: Smart Pointers Pin
Michael Dunn23-Sep-03 9:11
sitebuilderMichael Dunn23-Sep-03 9:11 
GeneralDialog Bars in WTL Pin
stilgar22-Sep-03 3:12
stilgar22-Sep-03 3:12 
GeneralRe: Dialog Bars in WTL Pin
Amit Dey30-Sep-03 10:41
Amit Dey30-Sep-03 10:41 
GeneralTrouble using WTL7.0 in a MFC project Pin
luedi21-Sep-03 23:00
luedi21-Sep-03 23:00 
GeneralRe: Trouble using WTL7.0 in a MFC project Pin
John M. Drescher22-Sep-03 18:16
John M. Drescher22-Sep-03 18:16 
GeneralRe: Trouble using WTL7.0 in a MFC project Pin
luedi22-Sep-03 21:07
luedi22-Sep-03 21:07 
GeneralRe: Trouble using WTL7.0 in a MFC project Pin
John M. Drescher23-Sep-03 4:53
John M. Drescher23-Sep-03 4: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.