Issue 16339: Improving usability of Reference<DELEGATE> class (dds-psm-cxx-ftf) Source: Real-Time Innovations (Dr. Sumant Tambe, sumant(at)rti.com) Nature: Revision Severity: Minor Summary: 1. Safety of Reference<D> class should be improved by adding "explicit" keyword in the following constructors: template <typename D> Reference(const Reference<D>& ref); template <typename R> Reference(const R& that); Reference(const DELEGATE_REF_T& ref); 2. With just member operator== and operator!= functions, Reference<D> can't be used in expressions like if(dds::null == r) { ... } Proposed solution: Add the following free functions in dds::core in Reference.hpp. template <class D> bool operator == (dds::null_type, const Reference<D> & r) { return r.is_nil(); } template <class D> bool operator != (dds::null_type, const Reference<D> & r) { return !r.is_nil(); } Resolution: Revised Text: Actions taken: June 17, 2011: received issue Discussion: End of Annotations:===== m: webmaster@omg.org Date: 17 Jun 2011 20:18:41 -0400 To: Subject: Issue/Bug Report ******************************************************************************* Name: Sumant Employer: Real-Time Innovations mailFrom: sumant@rti.com Terms_Agreement: I agree Specification: DDS PSM CXX Section: 7 FormalNumber: ptc/2011-01-02 Version: FTF Beta 1 Doc_Year: 2011 Doc_Month: January Doc_Day: 01 Page: 4 Title: Improving usability of Reference class Nature: Revision Severity: Minor CODE: 3TMw8 B1: Report Issue Description: 1. Safety of Reference class should be improved by adding "explicit" keyword in the following constructors: template Reference(const Reference& ref); template Reference(const R& that); Reference(const DELEGATE_REF_T& ref); 2. With just member operator== and operator!= functions, Reference can't be used in expressions like if(dds::null == r) { ... } Proposed solution: Add the following free functions in dds::core in Reference.hpp. template bool operator == (dds::null_type, const Reference & r) { return r.is_nil(); } template bool operator != (dds::null_type, const Reference & r) { return !r.is_nil(); }