If you define/forward-declare it as a private member of the visible class, it should not be accessible through other parts of the hypothetical API / product that you are building. You might provide...
Type: Posts; User: Ocifer
If you define/forward-declare it as a private member of the visible class, it should not be accessible through other parts of the hypothetical API / product that you are building. You might provide...
I also should add that I was able to answer one of my own questions. If the class used for the implementation object is declared locally (that is within the visible class), then it is considered a...
Was not expecting all these replies. I will add that I am learning about the PIMPL (compiler firewall) idiom to improve my knowledge of common practices. I've noticed a lot of Qt code that uses this...
Thank you both for the replies.
First, to milli, I think the issue you came across is that std::unique_ptr causes problems if you don't declare a destructor. I forward declared the implementation...
Hello,
I'm just wondering what is considered to be the best practice with respect to a pimpl class. Just for context, with the PIMPL idiom, one often uses a pointer to an implementation class to...
The comments you've heard against mixing Visual Studio with 3rd-party libraries likely stem from the commenters' confusion with setting up Visual Studio projects to use the libraries, or failed...
I was recently working on something that required a container of VERY non-POD data. I started off using the std::vector< T > container, but noticed a huge improvement in performance when I switched...
I apologize in returning to this question so late. Thank you very much for your answers, they were helpful.
Hello, I had a very general question, not a specific programming question. I've programmed in C++ before, and in assembly for the Motorola 68k in academic settings, if that helps answer.
How much...
Thank you! That is making it easier to understand the difference.
To clarify my question a bit more, std10093 wrote:
Is it the return keyword/construct that ensures this? What happens, in a logical step by step fashion? Is it something like
1. foo...
Thank you for your replies. Perhaps I was not clear. I am trying to understand the conceptual difference behind the rules that C uses to deal with these memory allocations. To vart, in your example,...
Hello, I've not programmed in C for a while, and I'm coming back to it. In attempting to use functions to allocate memory for a pointer, I've come across something I don't quite understand. This...
Hello all,
Thanks for the responses. I've updated the source files, and they compile
without any warnings or errors. I've attached them below in code tags.
I would also like to make sure I...
Hello,
It's been a while since I programmed, and I've gotten rusty on some of the main points. I've made a simple example to try to refresh my memory.
Basically, I have the source files...
Passing a pointer to a function, say a pointer to an integer variable, allows you to change the value of the integer variable pointed to by that pointer.
In your first code you posted, you were...
It's also (in my opinion) far nicer dealing with string manipulation using the std::string and its functions. Love c++ for this. Once you get used the built in string functions (maybe methods is more...
Do not think of it as "making" something true. Since we use Boolean expressions in programming to compare things so often, without changing the values themselves, you need to think of it more...
I've tutored students before in symbolic logic, and I can suggest googling links on "propositional logic" or "classical logic" first. There are many more names in use for the fundamental logic that...
It might even be better to change the thread title to "pass by pointer vs. pass by reference" or something, so that others can learn from my confusion. Mods? At heart, this had nothing to do with...
No you understood. I am just tired and have confused passing by reference and passing by pointers. Was able to find some good info on the net, thanks for the reply though. I had actually read about...
Hi all,
I've written programs before with file i/o in c++. There was one technique I learned for dealing with files and functions, and it seems to be standard (upon googling), but I was hoping...
thadis_4 has the right idea. The compiler cannot read your mind. As far as it's concerned you've told it about some functions, and some variables (which happen to share the same name, by your...
I was trying to think if there were other reasons, reduced compilation times also make a lot of sense. Good point.
Also, adding the :: becomes second nature pretty quickly. :: is also powerful, so don't just skip it because you don't want to type two extra colons.