Program Listing for File predicates.h

Return to documentation for file (aslam_cv2/aslam_cv_common/include/aslam/common/predicates.h)

#ifndef ASLAM_PREDICATES_H
#define ASLAM_PREDICATES_H

namespace aslam {

template<typename Value>
bool checkSharedEqual(const std::shared_ptr<Value> & lhs,
                      const std::shared_ptr<Value> & rhs) {
  if(lhs && rhs) {
    // if they are both nonnull, check for equality
    return (*lhs) == (*rhs);
  } else {
    // otherwise, check if they are both null
    return (!lhs) && (!rhs);
  }
}

} // namespace aslam


#endif /* ASLAM_PREDICATES_H */