Opened 13 years ago

Closed 12 years ago

#3937 closed Feature Requests (wontfix)

equal_pointees and invalid pointers

Reported by: NN Owned by: No-Maintainer
Milestone: Boost 1.43.0 Component: utility
Version: Boost 1.42.0 Severity: Optimization
Keywords: Cc:

Description

In file boost/utility/compare_pointees.hpp function equal_pointees treat invalid pointers as a positive value.

There should be added another function which treats invalid pointers as a negative value.

template<class OptionalPointee>
inline
bool equal_pointees ( OptionalPointee const& x, OptionalPointee const& y )
{
  return (!x) != (!y) ? false : ( !x ? true : (*x) == (*y) ) ;
}

template<class OptionalPointee>
inline
bool equal_pointees_false ( OptionalPointee const& x, OptionalPointee const& y )
{
  return (!x) != (!y) ? false : ( !x ? false : (*x) == (*y) ) ;
}

Thanx.

Change History (2)

comment:1 by Steven Watanabe, 13 years ago

I don't understand what you mean by negative and positive. equal_pointees returns true if both pointers are null or if both pointers are non-null and their targets are equal.

comment:2 by Steven Watanabe, 12 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.