pimpl-idiom Questions
2
Solved
The pimpl idiom, as far as I can tell, hides a private implementation behind a forward declared symbol name so it can be declared and used in the private cpp module.
Example: https://cpppatterns.c...
Flection asked 9/2, 2018 at 12:48
1
This is a follow up of this question: Does PIMPL idiom actually work using std::unique_ptr?
The full example uses multiple files, so for the sake of this question I will reduce it here. The full wo...
Placeman asked 8/3, 2022 at 15:27
12
Solved
I am reading the book "Exceptional C++" by Herb Sutter, and in that book I have learned about the PIMPL idiom. Basically, the idea is to create a structure for the private objects of a cl...
Anana asked 23/1, 2012 at 13:43
1
Solved
In my workplace, we have this convention: almost every class (with very few exceptions) is implemented with unique_ptrs, raw pointers or references as member variables.
This is because of compilati...
Tooling asked 20/5, 2021 at 7:17
2
I am using the pimpl idiom to hide the implementation details of an interface so that I can have some measure of ABI protection. I'm not that well versed on the ins and outs of MS...using Linux for...
Machutte asked 30/5, 2013 at 18:19
2
Solved
Qt makes heavy use of the PIMPL idiom in their development process: https://wiki.qt.io/D-Pointer
As I've read here: "The name 'd-pointer' stems from Trolltech's Arnt Gulbrandsen, who first introdu...
Confederation asked 23/10, 2019 at 10:2
5
Solved
I am trying to use the pimpl pattern and define the implementation class in an anonymous namespace. Is this possible in C++? My failed attempt is described below.
Is it possible to fix this withou...
Askari asked 21/4, 2011 at 14:38
7
we want to use pimpl idiom for certain parts of our project. These parts of the project also happen to be parts where dynamic memory allocation is forbidden and this decision is not in our control....
Fagin asked 7/2, 2011 at 13:38
2
The pimpl (also: compiler firewall) idiom is used to shorten compile times, at the cost of readability and a little runtime performance. At the moment a project takes to long to compile, how to mea...
Ligroin asked 27/2, 2016 at 12:36
7
Solved
I am writing a C++ header in which I define a
class A {
// ...
};
that I would like to hide from the outside world (because it may change or even be removed in future versions of this header). ...
Geanticlinal asked 25/4, 2011 at 17:13
1
Solved
I'm writing some code using pimpl idiom with unique_ptr. When I tried to use in-class initialization to set unique_ptr to nullptr by default, gcc gave a compile error, while clang and msvc both suc...
Apeman asked 14/10, 2019 at 11:34
1
Summary
I'm writing a library and a client application. In the library I'm trying to write a wrapper around another statically linked third-party library (specifically, spdlog) and am trying to use...
Doubleteam asked 9/6, 2019 at 18:13
2
Solved
The code would work file as long as I don't move the definition of constructor (of B) to the header B.h.
B.h
class Imp; //<--- error here
class B{
public:
std::unique_ptr<Imp> imp;
B(...
Gauldin asked 23/2, 2017 at 13:13
3
Solved
This is not a breaking issue but I like to clean my code from warnings so this is getting on my nerves.
I have been using the c++11 version of pimpl idiom to hide the class implementation for my ...
Zimmer asked 19/8, 2015 at 14:14
2
Solved
Why does the make_unique call compile? Doesn't make_unqiue require its template argument to be a complete type ?
struct F;
int main()
{
std::make_unique<F>();
}
struct F {};
The question ...
Roybal asked 5/9, 2018 at 8:38
2
Solved
I use "pointer to private implementation" classes often. The setter methods of those classes can technically be const member functions, such as this:
class MyPrivateClass
{
public:
int something ...
Cairns asked 27/3, 2018 at 22:12
2
Solved
Here is a simplification of what I'm seeing when I try to use unique_ptr for pimpl. I chose unique_ptr because I really want the class to own the pointer - I want the lifetimes of the pimpl pointer...
Ham asked 26/1, 2012 at 15:19
10
Solved
I was wondering what would make a programmer to choose either Pimpl idiom or pure virtual class and inheritance.
I understand that pimpl idiom comes with one explicit extra indirection for each pu...
Beneficial asked 5/5, 2009 at 14:5
2
Solved
Background
I have been learning how to implement the pimpl idiom using the newer c++11 method described by Herb Sutter at this page: https://herbsutter.com/gotw/_100/
I'm trying to modify this ex...
Sean asked 5/8, 2017 at 18:57
4
Solved
I've been making some objects using the pimpl idiom, but I'm not sure whether to use std::shared_ptr or std::unique_ptr.
I understand that std::unique_ptr is more efficient, but this isn't so muc...
Hypothermia asked 7/4, 2011 at 6:30
1
Solved
I'm reading Effective Modern C++ by Scott Meyers and he's discussing the use of the pimpl idiom and pointing to the implementation class with unique_ptr, but there is an issue of special member fun...
Wagoner asked 15/11, 2016 at 21:28
2
I have the following code:
In DLL1:
in .h file:
class MyClass
{
public:
MyClass();
private:
std::string m_name;
};
class __declspec(dllexport) Foo
{
private:
struct Impl;
Impl *pimpl;
publi...
Perse asked 2/2, 2016 at 13:55
2
Solved
I am Pimpling off the class STFT. Compiles just fine with this in the header:
class STFT; // pimpl off to prevent point name clash
class Whatever
{
private:
STFT* stft;
and this in the i...
Mangrove asked 3/12, 2015 at 17:51
5
Solved
The pImpl idiom in c++ aims to hide the implementation details (=private members) of a class from the users of that class.
However it also hides some of the dependencies of that class which is usua...
Whenas asked 6/5, 2010 at 23:29
1
Solved
Edit: This question dates from before C++17. These days std::launder or equivalent should be added to the line noise. I don't have time to update the code to match right now.
I am aspiring to sepa...
Mozza asked 17/11, 2015 at 23:28
1 Next >
© 2022 - 2024 — McMap. All rights reserved.