Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
accessibility on in-class typedefs
//g++ 4.9.3 #include <iostream> template<typename T> class QScopedPointer { //type alias does not need to be made public in order to use them in //public member functions as shown below. //you can use both syntax //typedef T* QScopedPointer::* RestrictedBool; using RestrictedBool = T* QScopedPointer::*; public: QScopedPointer(T* _d):d(_d){} inline operator RestrictedBool() const { return d==nullptr? nullptr : &QScopedPointer::d; } private: T* d; }; int main() { int a = 1; QScopedPointer<int> q1(&a); if(q1) std::cout<<"q1 has a pointer" << std::endl; else std::cout <<"q1 not has a pointer" << std::endl; return 0; }
run
|
edit
|
history
|
help
0
Wide string to lowercase
What exactly is “broken” with Microsoft Visual C++'s two-phase template instantiation?
Program of cube
cv2
Ελλάδα !!!!
5sdgts
asock
dhar1
calling conventions and using an override class to change another classes values
Overload resolve function pointer