|
Boost-Commit : |
From: daniel_james_at_[hidden]
Date: 2008-01-08 06:41:49
Author: danieljames
Date: 2008-01-08 06:41:48 EST (Tue, 08 Jan 2008)
New Revision: 42609
URL: http://svn.boost.org/trac/boost/changeset/42609
Log:
Use std::ptrdiff_t for minimal::ptr. Also add operator+(std::ptrdiff_t, ptr).
Text files modified:
branches/unordered/trunk/libs/unordered/test/objects/minimal.hpp | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
Modified: branches/unordered/trunk/libs/unordered/test/objects/minimal.hpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/objects/minimal.hpp (original)
+++ branches/unordered/trunk/libs/unordered/test/objects/minimal.hpp 2008-01-08 06:41:48 EST (Tue, 08 Jan 2008)
@@ -107,8 +107,9 @@
T* operator->() const { return ptr_; }
ptr& operator++() { ++ptr_; return *this; }
ptr operator++(int) { ptr tmp(*this); ++ptr_; return tmp; }
- ptr operator+(int s) const { return ptr<T>(ptr_ + s); }
- T& operator[](int s) const { return ptr_[s]; }
+ ptr operator+(std::ptrdiff_t s) const { return ptr<T>(ptr_ + s); }
+ friend ptr operator+(std::ptrdiff_t s, ptr p) { return ptr<T>(s + p.ptr_); }
+ T& operator[](std::ptrdiff_t s) const { return ptr_[s]; }
bool operator!() const { return !ptr_; }
operator bool_type() const {
@@ -151,7 +152,8 @@
T const* operator->() const { return ptr_; }
const_ptr& operator++() { ++ptr_; return *this; }
const_ptr operator++(int) { const_ptr tmp(*this); ++ptr_; return tmp; }
- const_ptr operator+(int s) const { return const_ptr(ptr_ + s); }
+ const_ptr operator+(std::ptrdiff_t s) const { return const_ptr(ptr_ + s); }
+ friend const_ptr operator+(std::ptrdiff_t s, const_ptr p) { return ptr<T>(s + p.ptr_); }
T const& operator[](int s) const { return ptr_[s]; }
bool operator!() const { return !ptr_; }
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk