Login | Register   
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.


Restrain Conversion Operators with the "Indirect Conversion" Idiom

Have you given up implicit conversions to bool because of the bugs they cause? Find out how the "indirect conversion" idiom can help you thwart undesirable conversions while still permitting well-behaved conversions.




Application Security Testing: An Integral Part of DevOps

onversion operators are a dilemma. While they certainly make the usage of certain objects convenient and intuitive, they also compromise type safety, ultimately leading to unexpected runtime behavior. The following sections present a technique that significantly reduces the potential hazards of implicit conversions to bool. This technique is now becoming a de-facto standard in C++ libraries, like Boost.

You want to add a conversion operator to your class, but you're concerned about the perils of implicit conversions.

Use the "indirect conversion" idiom to thwart undesirable conversions while still permitting well-behaved conversions.

Comment and Contribute






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



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date