I think that the point of Decorator pattern is to add functionality on runtime as opposed to inheritance, which is a compile-time determined behaviour.
If you ask me, it's kinda fancy and complex...
Type: Posts; User: Dave11
I think that the point of Decorator pattern is to add functionality on runtime as opposed to inheritance, which is a compile-time determined behaviour.
If you ask me, it's kinda fancy and complex...
I've being playing a bit with unicode encoding and decoding.
I wanted to write a function which gives the number of bytes a character takes from a leading byte in UTF8 encoding.
so if the byte...
Well, let's think a minute on what you want.
you want to mark the pointer for when it's occupied, when it's freed and when it points to some boundry:
so when the pointer is null - it's free....
good for them. there are better ways of doing things.
You don't set the pointer to some random data, even if you give that random human meaning.
pointers should either point to legit - living variables or to null. that's it.
when you're doing...
you don't need to call new and the destructor , they are called automatically.
when your class contain inner objects, their constructor is called automatically on the constructor of the object...
Stay away from MFC like fire.
The original problem with Windows programing back then was that the API (WinAPI) was no intuitive enough. you really programmed something only make sense to the OS...
Well, as aside to my C++ stuff at work, I also (obligated) to do many Node.js stuff, so yeah, I work with JS on daily basis.
even in JS world mixing unrelated types on an array is a bad thing,...
you can mix std::vector with "Any" class, this will give you proto-JS-arrays.
question being asked, why the hell would you want something like it?
you may want to switch to standard C++11 threads .
with your original function signature, the code would easily turned into
thread = std::thread(processFile,sFilePath);
(I'm having a deja-vu here)
you code is terribly C-like. all of the functions you wrote should be some member functions. you should have a "Tree" class which inserts "Node" objects. both "Tree" and...
Again, back in 2002, C++ defenitly was the dominating language. other languages did make their share out of the interest - cake. so yes, the interest in C++ has decresed but so for Java and PHP. this...
I don't think we see the same thing.
curently C++ is number 3 as of October 2015. it was ranked 4 last year's October.
yes, so what? other languages bit a chunk of interest along the years. but still, C/C++ stayed on top for a decade, and they move up and down along the years, but never one-way down.
You can also look at TIOBE Index:
TIOBE Software: The Coding Standards Company
Tiobe is a site which rates popularity of programing languages according Search-Engines statistics.
as you can...
"Smart pointers don't magically make C++ safe. The safety objection to C++ still applies."
-No language is 100% memory safe. in higher languages you get null pointer exception because every...
I wrote the * on top of 1.5 because I wanted to a comment ("on MSVC++") but I missed that.
and about reserve - I'm talking about extremly big vector size, like <1000 elements, for example.
since C++ is maybe the only language that allows you touch memory and the operating system directly while giving you the possiblity to write Object-Oriented code mixed with smart meta-programing I...
well, yes, accademically speaking.
std::vector has some optimizations tricks deep inside like expanding the capacity by 1.5* when reallocation happens, and many more.
and also, seasoned C++...
well, even though theoratically std::list should be faster than std::vector, in practice this theory breaks down.
std::vector is contiguous, which gives it the following features vs. std::list:...
Going back to the original answer - you will find these behaviour in every programing language forum.
Stack overflow downvote trivial qustion so Stack overflow stays "Professional-oriented" Q/A...
1. if we are to limit ourself to what the standard provides us,
the most clever program we could write is a multi-threaed console
application which reads and writes to files.
C++ is the...
and use a thread pool instead of launching threads irresponsibely.
So it's UB. ok, I see.
thanks.
you convinced me on the first.
about the second, I'm just thinking logically:
usually , the compiler breaks down a class to C-struct + the methods that are now global and also accepts 'this'...