RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: C++
Expertise: All
Mar 5, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Pseudo Destructors

Fundamental types have a pseudo destructor. A pseudo destructor is a syntactic construct whose sole purpose is to satisfy the need of generic algorithms and containers. It is a no-op code and has no real effect on its object.
typedef int N; 
int main()
  N i = 0;
  i.N::~N(); //1: pseudo destructor invocation
  i = 1; //i  was not affected by the invocation of the pseudo destructor 
  return 0;
In the example, N is used as a synonym for int. In the statement numbered 1, the pseudo destructor of the non-class type N is explicitly invoked. Similar to the constructors of fundamental types, pseudo destructors enable writing code without having to know if a destructor actually exists for a given type.
Danny Kalev
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date