SEARCH YOUR SOLUTION HERE  

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:  488
View Complete with Replies




Related Messages:

Is there a memory leak in this code ?   (185 Views)
// ----------------------------------- class Column { public: string name; vector values; }; // ----------------------------------- void loadValues() { Column p = new Column(); p->values.push_back(55); // values.push_back(66); //
Are there any long C string across multiple lines   (179 Views)
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.
Why there is just one namespace 'std' in the std library?   (196 Views)
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
Are there any template trigonometry functions?   (156 Views)
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.
using ostringstream for padding - is there a more concise way?   (213 Views)
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
Linux programming, is there any C++?   (150 Views)
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.
Linux programming, is there any C++?   (199 Views)
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.
Re: When will there by official support for ODBC in C++?   (162 Views)
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 ...
Is there such thing as invalid floating point ?   (221 Views)
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 ...
is there a way to tell the compiler that an object exists in adifferent translation unit?   (175 Views)
, 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 ...
Is there a Windows or C++ library function to break down a Filepath?   (178 Views)
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, ...
Why there are double semicolons at Include path of Project Options?   (192 Views)
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 ...
Is there systematic performance comparison of std::string and c style string?   (164 Views)
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...
is there a simple solution to this template problem?   (177 Views)
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 ...
are there c++ classes that provide file, directory or file systemfunctionality?   (172 Views)
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 ...
Is there any """Anti Stringizing operator #"""   (153 Views)
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 ...
Is there anything like JavaBeans in C++?   (176 Views)
Is there some standard (ish) way to build reusable graphic components in the C++ environment -Ramon...
is there any way to use macro to specialization a template class...   (183 Views)
#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 ...
have a look at my blog site for asp.net .. there is microsoft contest also ( u can win so much)   (205 Views)
have a look at my blog site for asp.net .. there is microsoft contest also ( u can win so much)...
Is there anyway to set stdout and stderr for a spawned process   (155 Views)
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 ...