Click here to Skip to main content
16,005,734 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Reading a large file Pin
valikac22-Apr-04 15:04
valikac22-Apr-04 15:04 
GeneralRe: Reading a large file Pin
hasansheik22-Apr-04 23:50
hasansheik22-Apr-04 23:50 
GeneralRe: Reading a large file Pin
Tom Wright23-Apr-04 4:38
Tom Wright23-Apr-04 4:38 
GeneralSTL list object Pin
mjackson1122-Apr-04 12:27
mjackson1122-Apr-04 12:27 
GeneralRe: STL list object Pin
valikac22-Apr-04 15:10
valikac22-Apr-04 15:10 
GeneralRe: STL list object Pin
Michael Dunn22-Apr-04 16:40
sitebuilderMichael Dunn22-Apr-04 16:40 
GeneralRe: STL list object Pin
mjackson1122-Apr-04 17:46
mjackson1122-Apr-04 17:46 
GeneralRe: STL list object Pin
Maxwell Chen22-Apr-04 19:07
Maxwell Chen22-Apr-04 19:07 
I did some corrections in your code, and now the below compiles with no errors.

Some operator overloadings are omitted ...

-------------------------------------------------------

#include <list>

namespace mrg
{
typedef int Date; // Assumption for this demo only.
template<class _Ty>
class mrgFwdPt
{
public:
mrgFwdPt()
{ }
mrgFwdPt(_Ty v, Date dt)
: _mVal(v)
{ }
~mrgFwdPt()
{ }

protected:
_Ty _mVal;
};

//=========================== end of point class ==========================================//

template<class _Ty>
class mrgFwdCrv
{
public:
mrgFwdCrv()
{
}
~mrgFwdCrv()
{
}

bool push_back(mrgFwdPt<_Ty> fp) // this line.
{
_mList.push_back(fp);
return true;
}

bool test_sort(void);

private:
std::list<mrgFwdPt<_Ty> > _mList;
};

template<class _Ty>
bool mrgFwdCrv<_Ty>::test_sort(void)
{
Date d;
list <mrgFwdPt<_Ty> >::iterator i;

for (i = _mList.begin(); i != _mList.end(); i++)
{
d = (*i)->GetFwdDt();
cout << d.DateString() << endl;
}

_mList.sort(less<mrgFwdPt<_Ty> >());

for (i = _mList.begin(); i != _mList.end(); i++)
{
d = (*i)->GetFwdDt();
cout << d.DateString() << endl;
}
}

}

void main()
{
mrg::mrgFwdPt<int> aa;
mrg::mrgFwdCrv<long> bb;
}

------------------------------------------------
------ Build started: Project: TestDos, Configuration: Debug Win32 ------

Compiling...
main.cpp
Linking...

Build log was saved at "file://d:\Tmp\TestEnv\VC7\DOS\TestDos\Debug\BuildLog.htm"
TestDos - 0 error(s), 0 warning(s)


---------------------- Done ----------------------

Build: 1 succeeded, 0 failed, 0 skipped




<b>Maxwell Chen</b>
GeneralRe: STL list object Pin
mjackson1123-Apr-04 1:37
mjackson1123-Apr-04 1:37 
GeneralChar* -&gt; DWORD conversion Pin
__Cerb22-Apr-04 11:14
__Cerb22-Apr-04 11:14 
GeneralRe: Char* -&gt; DWORD conversion Pin
ravjak22-Apr-04 11:28
ravjak22-Apr-04 11:28 
GeneralRe: Char* -&gt; DWORD conversion Pin
__Cerb22-Apr-04 11:31
__Cerb22-Apr-04 11:31 
GeneralRe: Char* -&gt; DWORD conversion Pin
Michael Dunn22-Apr-04 16:42
sitebuilderMichael Dunn22-Apr-04 16:42 
GeneralProblem overloading operators in templated classes Pin
22-Apr-04 10:36
suss22-Apr-04 10:36 
GeneralRe: Problem overloading operators in templated classes Pin
mjackson1122-Apr-04 12:29
mjackson1122-Apr-04 12:29 
GeneralTest your C++ knowledge with these questions! Pin
soer22-Apr-04 10:17
soer22-Apr-04 10:17 
GeneralRe: Test your C++ knowledge with these questions! Pin
Navin22-Apr-04 10:39
Navin22-Apr-04 10:39 
GeneralRe: Test your C++ knowledge with these questions! Pin
Antony M Kancidrowski22-Apr-04 10:58
Antony M Kancidrowski22-Apr-04 10:58 
GeneralRe: Test your C++ knowledge with these questions! Pin
ravjak22-Apr-04 11:33
ravjak22-Apr-04 11:33 
GeneralRe: Test your C++ knowledge with these questions! Pin
soer22-Apr-04 16:21
soer22-Apr-04 16:21 
GeneralRe: Test your C++ knowledge with these questions! Pin
FlyingDancer22-Apr-04 14:27
FlyingDancer22-Apr-04 14:27 
QuestionHow to display a transparent PNG using CxImage??? Pin
randythawkins22-Apr-04 9:21
randythawkins22-Apr-04 9:21 
Generaldrawing dot and rect Pin
lvidot22-Apr-04 7:22
lvidot22-Apr-04 7:22 
GeneralRe: drawing dot and rect Pin
jmkhael22-Apr-04 7:32
jmkhael22-Apr-04 7:32 
GeneralTrace to Output window or Command Window in MSDEV Pin
pny22-Apr-04 7:02
pny22-Apr-04 7:02 

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.