Why there is an error?


, recently I read the book "c++ template complete guide", there is a slice code that I am quite confused. (pasted here). Why there is an error Actually I can compile it on Linux, and there is only an ...
Posted On: Sunday 25th of November 2012 11:01:24 PM Total Views:  419
View Complete with Replies

RELATED TOPICS OF C Language PROGRAMMING LANGUAGE




Is there a memory leak in this code ?

// ----------------------------------- class Column { public: string name; vector values; }; // ----------------------------------- void loadValues() { Column p = new Column(); p->values.push_back(55); // values.push_back(66); //
VIEWS ON THIS POST

153

Posted on:

Wednesday 7th November 2012
View Replies!

Are there any long C string across multiple lines

In python, triple quote (""") can be used to quote a paragraph (multiple lines). I'm wondering if there is any equivalent in C++. For the following code, I could write the long string in a single line with "\n" in the middle, or I could use multiple cout and endl. But I just feel more readable if I can have the whole paragraph as a string.
VIEWS ON THIS POST

152

Posted on:

Wednesday 7th November 2012
View Replies!

Why there is just one namespace 'std' in the std library?

Is there any specific reason(s) that there is only one namespace 'std' in the standard library e.g. namespaces are not really independent, name collisions etc. Should one consider not introducing too many namespaces while designing a new system ground up
VIEWS ON THIS POST

153

Posted on:

Wednesday 7th November 2012
View Replies!

Are there any template trigonometry functions?

I'm wondering if there are any template trigonometry functions in C++. I used the following code for that purpose. But if the library has it, it will be better.
VIEWS ON THIS POST

129

Posted on:

Wednesday 7th November 2012
View Replies!

using ostringstream for padding - is there a more concise way?

I'm new to string streams and kind of curious about this one. Is there a more concise way to format a padded string then this (using string streams) ostringstream strstrm; strstrm.width(10); strstrm
VIEWS ON THIS POST

162

Posted on:

Wednesday 7th November 2012
View Replies!

Linux programming, is there any C++?

I'm kind of new to Linux and I've started downloading applications and installing them. Applications are distributed as source code in a ".tar.gz" file. You unzip the file, navigate to the directory, run "configure", then run "make", then run "make install". Anyway, in all the programs I've seen, there's only ever been .c files, and it looks like only gcc has been invoked. Do people in the Linux community not use C++ and distribute their source in ".tar.gz" -- Toms hilidhe , Toms hilidhe wrote: > I'm kind of new to Linux and I've started downloading applications and > installing them. Applications are distributed as source code in a > ".tar.gz" file. You unzip the file, navigate to the directory, run > "configure", then run "make", then run "make install". > > Anyway, in all the programs I've seen, there's only ever been .c files, and > it looks like only gcc has been invoked. Do people in the Linux community > not use C++ and distribute their source in ".tar.gz" C and Unix have a lot of history together. C was invented specifically to write Unix, and remains the lingua franca for linking object files compiled from different source languages. , Jeff Schwab wrote: > > I personally love both Unix and C++. I use C for device drivers, but > prefer C++ for user-space applications. Why make that distinction Provided you avoid language features that require run time support, C++ is an excellent language for drivers. -- Ian Collins. , Jeff Schwab wrote: > Ian Collins wrote: >> Jeff Schwab wrote: >>> I personally love both Unix and C++. I use C for device drivers, but >>> prefer C++ for user-space applications. >> >> Why make that distinction Provided you avoid language features that >> require run time support, C++ is an excellent language for drivers. > > If I ever gave a client a Unix device driver written in C++, I'd be told > to re-write it. (I know this for a face, since I've suggested it.) The > problem is that the overwhelming majority of people who professionally > write Unix device drivers are far more comfortable with C then C++, so > maintenance of a C++ driver on Unix is potentially much more expensive. > Fair enough, I've only ever had to supply binary drivers. A large proportion of C drivers I've seen (especially NIC drivers) tend to be written in pseudo OO C. -- Ian Collins.
VIEWS ON THIS POST

126

Posted on:

Saturday 10th November 2012
View Replies!

Linux programming, is there any C++?

I'm kind of new to Linux and I've started downloading applications and installing them. Applications are distributed as source code in a ".tar.gz" file. You unzip the file, navigate to the directory, run "configure", then run "make", then run "make install". Anyway, in all the programs I've seen, there's only ever been .c files, and it looks like only gcc has been invoked. Do people in the Linux community not use C++ and distribute their source in ".tar.gz" -- Toms hilidhe , Toms hilidhe wrote: > I'm kind of new to Linux and I've started downloading applications and > installing them. Applications are distributed as source code in a > ".tar.gz" file. You unzip the file, navigate to the directory, run > "configure", then run "make", then run "make install". > > Anyway, in all the programs I've seen, there's only ever been .c files, and > it looks like only gcc has been invoked. Do people in the Linux community > not use C++ and distribute their source in ".tar.gz" C and Unix have a lot of history together. C was invented specifically to write Unix, and remains the lingua franca for linking object files compiled from different source languages. , Jeff Schwab wrote: > > I personally love both Unix and C++. I use C for device drivers, but > prefer C++ for user-space applications. Why make that distinction Provided you avoid language features that require run time support, C++ is an excellent language for drivers. -- Ian Collins. , Jeff Schwab wrote: > Ian Collins wrote: >> Jeff Schwab wrote: >>> I personally love both Unix and C++. I use C for device drivers, but >>> prefer C++ for user-space applications. >> >> Why make that distinction Provided you avoid language features that >> require run time support, C++ is an excellent language for drivers. > > If I ever gave a client a Unix device driver written in C++, I'd be told > to re-write it. (I know this for a face, since I've suggested it.) The > problem is that the overwhelming majority of people who professionally > write Unix device drivers are far more comfortable with C then C++, so > maintenance of a C++ driver on Unix is potentially much more expensive. > Fair enough, I've only ever had to supply binary drivers. A large proportion of C drivers I've seen (especially NIC drivers) tend to be written in pseudo OO C. -- Ian Collins.
VIEWS ON THIS POST

173

Posted on:

Saturday 10th November 2012
View Replies!

Re: When will there by official support for ODBC in C++?

On Dec 18 2007, 5:15 pm, ap...@student.open.ac.uk wrote: [...] > When will ODBC support be an official part of C++ Each time I need to > do database work in C++ I have to check out the latest state of ...
VIEWS ON THIS POST

132

Posted on:

Saturday 10th November 2012
View Replies!

Is there such thing as invalid floating point ?

I am working on an IO library, and I am reading a binary blob which represent a floating point. I would like to know what is the correct way to interpret it. For integer type using a stringstream works ...
VIEWS ON THIS POST

162

Posted on:

Saturday 10th November 2012
View Replies!

is there a way to tell the compiler that an object exists in adifferent translation unit?

, I have this problem that is driving me crazy! I have a typedef for a singleton object in a file "fileA.h", then I try to use that object in "fileB.h" and then the compiler says that the object ...
VIEWS ON THIS POST

143

Posted on:

Saturday 10th November 2012
View Replies!

Is there a Windows or C++ library function to break down a Filepath?

My application receives a filepath as an argument. Obviously, it can come in several formats, such as: filename.ext ..\filename.ext ...\..\filename.ext this\is_a\relative\path\finally.ext C:\fully\qualified\path\filename.ext ....and so on. In Unix there is a function which will do the right thing in every case, ...
VIEWS ON THIS POST

143

Posted on:

Saturday 10th November 2012
View Replies!

Why there are double semicolons at Include path of Project Options?

In the project option source file, I saw the following line: I do not understand why there are double semicolons (; in between. I found I could not replace it with single semicolon, otherwise there will be ...
VIEWS ON THIS POST

163

Posted on:

Saturday 10th November 2012
View Replies!

Is there systematic performance comparison of std::string and c style string?

Is there any comparison data on perfomance difference between std::string and c style string Or maybe if there are source code which could be used to measuer on different compiler/platform, in a systematic way...
VIEWS ON THIS POST

131

Posted on:

Saturday 10th November 2012
View Replies!

is there a simple solution to this template problem?

Hi , The idea is quite simple: generate a container with random values in it. For that, I decided to create a class that I called RandomContainer that inherits from a container (with default value std::vector). To handle the different ...
VIEWS ON THIS POST

146

Posted on:

Saturday 10th November 2012
View Replies!

are there c++ classes that provide file, directory or file systemfunctionality?

In a program i'm writing, I need to be able to serve files from a specified directory. I don't want to reinvent the wheel by writing a class that provides basic directory a file functionality if something similar already ...
VIEWS ON THIS POST

137

Posted on:

Sunday 11th November 2012
View Replies!

Is there any """Anti Stringizing operator #"""

Hi everybody I've a string that contains the name of a class. Some members told that I can use """Stringizing Operator (#)""", but the problem is here, that I have the string, & I want something vice- versa. As we ...
VIEWS ON THIS POST

118

Posted on:

Sunday 11th November 2012
View Replies!

Is there anything like JavaBeans in C++?

Is there some standard (ish) way to build reusable graphic components in the C++ environment -Ramon...
VIEWS ON THIS POST

143

Posted on:

Sunday 11th November 2012
View Replies!

is there any way to use macro to specialization a template class...

#include using namespace std; template class TC { public: void fn() { cout<<"i1 "< DTC;//error,why......................... //................... //any other solution for this except for typedef //typedef TC DTC;//ok void ...
VIEWS ON THIS POST

155

Posted on:

Sunday 11th November 2012
View Replies!

have a look at my blog site for asp.net .. there is microsoft contest also ( u can win so much)

have a look at my blog site for asp.net .. there is microsoft contest also ( u can win so much)...
VIEWS ON THIS POST

178

Posted on:

Monday 12th November 2012
View Replies!

Is there anyway to set stdout and stderr for a spawned process

Hi Does any one has idea about how to set stdout and stderr to a spawned process I don't want to have all the handles of the parent process in the child process but I want only one of ...
VIEWS ON THIS POST

133

Posted on:

Sunday 25th November 2012
View Replies!