¡@

Home 

c++ Programming Glossary: he

Why is processing a sorted array faster than an unsorted array?

http://stackoverflow.com/questions/11227809/why-is-processing-a-sorted-array-faster-than-an-unsorted-array

that seems very peculiar. For some strange reason sorting the data miraculously speeds up the code by almost 6x #include algorithm.. strange reason sorting the data miraculously speeds up the code by almost 6x #include algorithm #include ctime #include.. unsigned c 0 c arraySize c data c std rand 256 With this the next loop runs faster std sort data data arraySize Test clock_t..

Is there a production ready lock-free queue or hash implementation in C++

http://stackoverflow.com/questions/1164023/is-there-a-production-ready-lock-free-queue-or-hash-implementation-in-c

there a production ready lock free queue or hash implementation.. be welcome. SUMMARY So far i have no positive answer. There is no production ready library and amazingly none of the existent.. is no production ready library and amazingly none of the existent libraries complies to the API of STL containers. c..

Which I/O library do you use in your C++ code? [closed]

http://stackoverflow.com/questions/119098/which-i-o-library-do-you-use-in-your-c-code

use in your C code closed In new C code I tend to use the C iostream library instead of the C stdio library. I've noticed.. C code I tend to use the C iostream library instead of the C stdio library. I've noticed some programmers seem to stick.. stdio insisting that it's more portable. Is this really the case What do you use c iostream stdio share improve this..

How to read file content into istringstream?

http://stackoverflow.com/questions/132358/how-to-read-file-content-into-istringstream

performance reading from a file I'm trying to read the entire content of a big several MB file into memory and then.. entire content of a big several MB file into memory and then use a istringstream to access the information. My question.. file into memory and then use a istringstream to access the information. My question is which is the best way to read this..

Why doesn't C++ have a garbage collector?

http://stackoverflow.com/questions/147130/why-doesnt-c-have-a-garbage-collector

collector I'm not asking this question because of the merits of garbage collection first of all. My main reason for.. point in time. With that said why hasn't it been added There are already some garbage collectors for C . Is this just one.. one of those easier said than done type things Or are there other reasons it hasn't been added and won't be added in C..

How to pass parameters correctly?

http://stackoverflow.com/questions/15600499/how-to-pass-parameters-correctly

to pass parameters correctly As I said in my other questions I am a C beginner but not a programming beginner... I'm trying to learn C c 11 and it's kinda unclear for me the most important thing passing parameters. I considered these.. the most important thing passing parameters. I considered these simple examples A class that has all its members primitive..

Is there a way to simulate the C++ 'friend' concept in Java?

http://stackoverflow.com/questions/182278/is-there-a-way-to-simulate-the-c-friend-concept-in-java

there a way to simulate the C 'friend' concept in Java I would.. there a way to simulate the C 'friend' concept in Java I would like to be able to write.. which can access non public methods of a class in another package without having to make it a subclass of the other class...

Is it okay to inherit implementation from STL containers, rather than delegate?

http://stackoverflow.com/questions/2034916/is-it-okay-to-inherit-implementation-from-stl-containers-rather-than-delegate

it okay to inherit implementation from STL containers rather than delegate .. it okay to inherit implementation from STL containers rather than delegate I have a class that adapts std vector to model.. of domain specific objects. I want to expose most of the std vector API to the user so that he she may use familiar methods..

Why pure virtual function is initialized by 0?

http://stackoverflow.com/questions/2156634/why-pure-virtual-function-is-initialized-by-0

to 0. What I understand is that this is to initialize the vtable entry for this function to NULL and any other value here.. the vtable entry for this function to NULL and any other value here results in a compile time error. Please tell me.. vtable entry for this function to NULL and any other value here results in a compile time error. Please tell me whether this..

Read whole ASCII file into C++ std::string

http://stackoverflow.com/questions/2602013/read-whole-ascii-file-into-c-stdstring

it in a C std string . If I were to read it into a char the answer would be very simple std ifstream t int length t.open.. file.txt open input file t.seekg 0 std ios end go to the end length t.tellg report location this is the length t.seekg.. end go to the end length t.tellg report location this is the length t.seekg 0 std ios beg go back to the beginning buffer..

C++ Timer function to provide time in nano seconds

http://stackoverflow.com/questions/275004/c-timer-function-to-provide-time-in-nano-seconds

to provide time in nano seconds I wish to calculate the time it took for an API to return a value. The time taken for.. calculate the time it took for an API to return a value. The time taken for such an action is in the space of nano seconds... return a value. The time taken for such an action is in the space of nano seconds. As the API is a C class function I am..

Why no default move-assignment/move-constructor?

http://stackoverflow.com/questions/4819936/why-no-default-move-assignment-move-constructor

to write assignment operators or copy constructors as these are implemented by default. Add to this if I use std move.. this if I use std move on objects not movable it utilizes the assignment operator meaning std move is perfectly safe. As I'm.. As I'm a simple programmer I'd like to take advantage of the move capabilities without adding a move constructor assignment..

OpenCV - cvWaitKey( )

http://stackoverflow.com/questions/5217519/opencv-cvwaitkey

Can you just explain what cvWaitKey does I saw it from the OpenCV reference but it wasn't clear for me Thanks. c c opencv.. press. If a key was pressed during that time it returns the key's ASCII code. Otherwise it returns 1 . It handles any windowing.. during that time it returns the key's ASCII code. Otherwise it returns 1 . It handles any windowing events such as..

How to setup Google C++ Testing Framework (gtest) on Visual Studio 2005

http://stackoverflow.com/questions/531941/how-to-setup-google-c-testing-framework-gtest-on-visual-studio-2005

gtest on Visual Studio 2005 It is not documented on the web site and people seems having problem setting up the framework... the web site and people seems having problem setting up the framework. Can someone please show step by step introduction.. question What Arlaharen said was basically right except he left out the part which explains your linker errors. First of..

What is the C++ iostream endl fiasco?

http://stackoverflow.com/questions/5492380/what-is-the-c-iostream-endl-fiasco

is the C iostream endl fiasco I was listening to a google talk by.. was listening to a google talk by Andrei Alexandrescu on the D programming language when he threw out a one liner about the.. talk by Andrei Alexandrescu on the D programming language when he threw out a one liner about the endl fiasco. I just thought..

Why should `new` be used as little as possible?

http://stackoverflow.com/questions/6500313/why-should-new-be-used-as-little-as-possible

`new` be used as little as possible I stumbled upon the Stack Overflow question Memory leak with std string when using.. the Stack Overflow question Memory leak with std string when using std list std string and one of the comments says this.. with std string when using std list std string and one of the comments says this Stop using new so much. I can't see any reason..

What is “rvalue reference for *this”?

http://stackoverflow.com/questions/8610571/what-is-rvalue-reference-for-this

read quite a bit about rvalue references and understood them but I don't think I know about this. I also couldn't find much.. I know about this. I also couldn't find much resources on the web using the terms. There's a link to the proposal paper on.. I also couldn't find much resources on the web using the terms. There's a link to the proposal paper on the page N2439..

Check if a class has a member function of a given signature

http://stackoverflow.com/questions/87372/check-if-a-class-has-a-member-function-of-a-given-signature

if a class has a member function of a given signature I'm.. has a specific member function of a given signature. The problem is similar to the one cited here http www.gotw.ca gotw.. function of a given signature. The problem is similar to the one cited here http www.gotw.ca gotw 071.htm but not the same..

Unit testing for C++ code - Tools and methodology

http://stackoverflow.com/questions/91384/unit-testing-for-c-code-tools-and-methodology

for a few years now. As part of an effort to improve the quality of the existing code we engaged on a large long term.. years now. As part of an effort to improve the quality of the existing code we engaged on a large long term refactoring project... term refactoring project. Do you know a good tool that can help me write unit tests in C Maybe something similar to Junit..

How can I find the actual path found by BFS?

http://stackoverflow.com/questions/9590299/how-can-i-find-the-actual-path-found-by-bfs

can I find the actual path found by BFS The problem I'm trying to solve concerns.. can I find the actual path found by BFS The problem I'm trying to solve concerns a tree of MRT system. Like.. a tree of MRT system. Like this one Feel free to ignore the Chinese words though. Each node can be connected to 4 points..

Are the days of passing const std::string & as a parameter over?

http://stackoverflow.com/questions/10231349/are-the-days-of-passing-const-stdstring-as-a-parameter-over

std string as a parameter over I heard a recent talk by Herb Sutter who suggested that the reasons to pass std vector and.. pass std vector and std string by const are largely gone. He suggested that writing a function such as the following is now.. by reference is still a good idea. Can anyone explain why Herb might have said this c c 11 share improve this question..

Boost and XML (c++)

http://stackoverflow.com/questions/1042855/boost-and-xml-c

5 30 faster than pugixml the fastest XML parser I know of He had tested against version 0.3 of pugixml which has reached.. 0.3 of pugixml which has reached recently version 0.42. Here is an excerpt from pugixml documentation The main features..

Is there a reason to not use Boost? [closed]

http://stackoverflow.com/questions/1226206/is-there-a-reason-to-not-use-boost

my colleague today about using Boost in our new C project. He did not agreed to use Boost as he thinks that Boost is huge..

How is std::string implemented?

http://stackoverflow.com/questions/1466073/how-is-stdstring-implemented

Item 15 Be aware of variations in string implementations . He talks about 4 variations several variations on a ref counted.. the string instead of dynamically allocating a buffer Also Herb Sutter's More Exceptional C has an appendix Appendix A Optimizations..

C++ Which is faster: Stack allocation or Heap allocation

http://stackoverflow.com/questions/161053/c-which-is-faster-stack-allocation-or-heap-allocation

Which is faster Stack allocation or Heap allocation This question may sound fairly elementary but.. things where I could instead of heap allocating them. He was talking to me and watching over my shoulder and commented..

Send and Receive a file in socket programming in Linux with C/C++ (GCC/G++)

http://stackoverflow.com/questions/2014033/send-and-receive-a-file-in-socket-programming-in-linux-with-c-c-gcc-g

tee see the rather good explanation from Linus himself . He points out how using splice is basically just like the loop..

Why pure virtual function is initialized by 0?

http://stackoverflow.com/questions/2156634/why-pure-virtual-function-is-initialized-by-0

time I saw no chance of getting a new keyword accepted. He also states explicitly that this need not set the vtable entry..

Why does C++ support memberwise assignment of arrays within structs, but not generally?

http://stackoverflow.com/questions/3437110/why-does-c-support-memberwise-assignment-of-arrays-within-structs-but-not-gen

variable assignment struct share improve this question Here's my take on it The Development of the C Language offers some.. when Dennis Ritchie tried to extend B with struct types. He wanted arrays to be part of the structs like in C today struct..

what is/are the purpose(s) of inline?

http://stackoverflow.com/questions/3647053/what-is-are-the-purposes-of-inline

static void someFunction MYCLASS GetInstance someFunction He stated that Putting this as an inline function may save code.. PITA IMO . See the DDJ article on Moving Templates Out of Header Files If you are feeling weird read on this other article..

Value initialization and Non POD types

http://stackoverflow.com/questions/3931312/value-initialization-and-non-pod-types

was correct. However my answer was downvoted by Martin B . He said You're just lucky and are getting zeros because the memory..

5 years later, is there something better than the “Fastest Possible C++ Delegates”?

http://stackoverflow.com/questions/4298408/5-years-later-is-there-something-better-than-the-fastest-possible-c-delegate

Clugston attempts to achieve in his Code Project article. He does so using intimate knowledge of the most popular compilers... And while we're doing that why not generalize it as well Hey let's throw in an operator so we can call it like a function..

Performance of qsort vs std::sort?

http://stackoverflow.com/questions/4708105/performance-of-qsort-vs-stdsort

According Scott Meyers in his Effective STL book item 46. He claimed that std sort is about 670 faster than std qsort due..

Why doesn't C++ support functions returning arrays?

http://stackoverflow.com/questions/5157439/why-doesnt-c-support-functions-returning-arrays

only the reference TO the memory is limited by the scope. Here's where pass by value and pass by reference come in. Passing.. best features from Simula but remained powerful and fast. He chose to extend C due to its already legendary performance and..

What is the C++ iostream endl fiasco?

http://stackoverflow.com/questions/5492380/what-is-the-c-iostream-endl-fiasco

improve this question Reposting from my comment I assume He just means that many especially new C programmers use std endl..

make_unique and perfect forwarding

http://stackoverflow.com/questions/7038357/make-unique-and-perfect-forwarding

ptr perfect forwarding share improve this question Herb Sutter chair of the C standardization committee writes on.. and it will almost certainly be added in the future. He also gives an implementation that is identical with the one..

What is “rvalue reference for *this”?

http://stackoverflow.com/questions/8610571/what-is-rvalue-reference-for-this

too Now onto why @Nicol's answer is atleast partly wrong. He says Note that this declaration changes the type of this . That..

while (1) Vs. for (;;) Is there a speed difference?

http://stackoverflow.com/questions/885908/while-1-vs-for-is-there-a-speed-difference

it gets buried. It came from an AMD assembly programmer. He stated that C programmers the poeple don't realize that their.. poeple don't realize that their code has inefficiencies. He said today though gcc compilers are very good and put people.. are very good and put people like him out of business. He said for example and told me about the while 1 vs for . I use..

Unnecessary curly braces in C++?

http://stackoverflow.com/questions/9704083/unnecessary-curly-braces-in-c

code review for a colleague today I saw a peculiar thing. He had surrounded his new code with curly braces like this Constructor..