CFanatic

Go Back   CFanatic > Programming > MFC Programming

Join CFanatic Forum Now

Question about Templates topic posted under MFC Programming which is a part of Programming category in CFanatic Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 09-10-2010, 03:30 PM
Junior Member
 
Join Date: Sep 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
silver_boy is on a distinguished road
| More
Question about Templates

Hi , I was reading a detailed article about templates and I came across the following paragraph

template
class Stack
{
T data[N]; // Fixed capacity is N
size_t count;
public:
void push(const T& t);
};


"You must provide a compile-time constant value for the parameter N when you request an instance of this template, such as Stack myFixedStack;
Because the value of N is known at compile time, the underlying array (data) can be placed on the run time stack instead of on the free store.This can improve runtime performance by avoiding the overhead associated with dynamic memory allocation.

Question:
Now in the above paragraph what does
"This can improve runtime performance by avoiding the overhead associated with dynamic memory allocation." mean ?? What does template over head mean ??
I am a bit puzzled and i would really appreciate it if some one could explain to me what this sentence means thanks...
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question techinspiration C Programming 4 01-23-2011 01:51 AM
ReadDirectoryChangesW question Elysia Win32 Programming 0 08-31-2010 04:11 AM
little question! creative C++ Programming 7 05-28-2010 07:35 PM
Question rohitphulsunge C Programming 1 02-23-2010 04:26 AM
hi question about c zinoun C Programming 1 03-22-2009 10:32 PM

 

Advertisement

CFanatic Search
Custom Search

Advertisement

All times are GMT -5. The time now is 05:01 AM.



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Cfanatic.com is a premier member of the IDG TechNetwork. For advertising opportunities contact here
Get Paid for Working on Projects Matching Your Expertise at Go4Expert's Jobs Board