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

ATL / WTL / STL

 
GeneralATL 7.0 Book Pin
jparsons27-Sep-03 14:22
jparsons27-Sep-03 14:22 
GeneralHTML PARAM question Pin
alex.barylski27-Sep-03 12:51
alex.barylski27-Sep-03 12:51 
GeneralProblem with ContextMenu Pin
Tommy2k27-Sep-03 10:14
Tommy2k27-Sep-03 10:14 
GeneralRe: Problem with ContextMenu Pin
Michael Dunn27-Sep-03 10:33
sitebuilderMichael Dunn27-Sep-03 10:33 
GeneralCreate Drag Image (Drag'n'Drop) Pin
Jens Sorensen27-Sep-03 7:40
Jens Sorensen27-Sep-03 7:40 
GeneralRe: Create Drag Image (Drag'n'Drop) Pin
Michael Dunn27-Sep-03 8:13
sitebuilderMichael Dunn27-Sep-03 8:13 
GeneralRe: Create Drag Image (Drag'n'Drop) Pin
Jens Sorensen27-Sep-03 10:15
Jens Sorensen27-Sep-03 10:15 
GeneralSTL functor Pin
Koray Balci25-Sep-03 10:53
Koray Balci25-Sep-03 10:53 
I just finished the functor article here, and tried sth for rendering particles using functors. all seems to work fine, but I just wanted to make sure I didn't make sth stupid/ugly. here is the code;

<br />
template <class TParticle><br />
class ParticleRenderer<br />
{<br />
public: <br />
	virtual void render(const std::vector<TParticle>& particles) = 0;<br />
};<br />


this is the base class, and I wonder, having a hierarchy of functors is a good idea or not (performancewise especially)

<br />
template <class TParticle><br />
class DefaultRenderer : public ParticleRenderer<TParticle><br />
{<br />
public: <br />
	void render(const std::vector<TParticle>& particles)<br />
	{<br />
		std::for_each(particles.begin(), particles.end(), *this);<br />
	}<br />
	void operator ()(const TParticle& p) const<br />
	{<br />
             // rendering is done here.. <br />
	}<br />
};<br />

inside the operator() I do the rendering on each TParticle instance.

and here is how my Particles are stored..
<br />
template <size_t size, class TParticle><br />
class ParticleSystem<br />
{<br />
	ParticleRenderer<TParticle>* m_pRenderer;<br />
	std::vector<TParticle> m_particles;<br />
	void render(){<br />
		m_pRenderer->render(m_particles);<br />
        }<br />
 //other stuff..<br />
}<br />


so I can set different kinds of renderers (depending on client hardware), I don't need to check which renderer to use in everytime I call ParticleSystem::render. But this also means that some auxilary functions and member vars will be added to each derived renderer classes..

I would like to have some feedback, before implementing all.. thanks in advance.
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 
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 

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.