大约有 4,090 项符合查询结果(耗时:0.0381秒) [XML]
Is std::vector so much slower than plain arrays?
...ector. So much for the compiler being smart enough to optimize out all the C++ness and make STL containers as fast as raw arrays.
The bottom line is that the compiler is unable to optimize away the no-op default constructor calls when using std::vector. If you use plain new[] it optimizes them away...
What should go into an .h file?
...PL. #2 would be possible if export was supported and may be possible using c++0x and extern templates. IMO, header files in c++ lose much of their usefulness.
– KitsuneYMG
Dec 22 '09 at 12:39
...
What is the difference between “Include Directories” and “Additional Include Directories”
In configuration properties of my project, under the "VC++ directories" there is an entry for "Include Directories". But under "C/C++" option, there is another entry called "Additional Include Directories". Same thing happens with library directories.
...
Why does string::compare return an int?
...ntegral
promotion, so there's no point in returning anything smaller.
In C++ (as in C), every expression is either an rvalue or an
lvalue. Historically, the terms refer to the fact that lvalues
appear on the left of an assignment, where as rvalues can only
appear on the right. Today, a simple ap...
Why is the asterisk before the variable name, rather than after the type?
...
float an_element = my_array[2];
and: int copy_of_value = *myVariable;.
C++ throws a spanner in the works with references, because the syntax at the point where you use references is identical to that of value types, so you could argue that C++ takes a different approach to C. On the other hand, ...
error: use of deleted function
I've been working on some C++ code that a friend has written and I get the following error that I have never seen before when compiling with gcc4.6:
...
Is it possible to print a variable's type in standard C++?
...
C++11 update to a very old question: Print variable type in C++.
The accepted (and good) answer is to use typeid(a).name(), where a is a variable name.
Now in C++11 we have decltype(x), which can turn an expression into a t...
What is the purpose of using -pedantic in GCC/G++ compiler?
...your program if this is at all possible. However, in some
cases, the C and C++ standards specify that certain extensions are forbidden. Conforming compilers
such as gcc or g++ must issue a diagnostic when these extensions are encountered. For example,
the gcc compiler’s -pedantic option causes gcc...
How to change the default GCC compiler in Ubuntu?
... /usr/bin/cc cc /usr/bin/gcc-4.8 \
--slave /usr/bin/c++ c++ /usr/bin/g++-4.8 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.8 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-4.8 \
--slave /usr/bin/gcov-dump gcov-dump /usr...
When do we have to use copy constructors?
I know that C++ compiler creates a copy constructor for a class. In which case do we have to write a user-defined copy constructor? Can you give some examples?
...