Re: downcast copy algorithm request
- From: "Christopher Yeleighton" <ChristopherYeleighton@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 26 Apr 2005 13:10:14 -0700
"Doug Harrison [MVP]" wrote:
> Or, you can write your own minimalistic input iterator adapter class, which
> you would use something like this:
>
> std::copy(
> static_cast_iterator<B*>(pa),
> static_cast_iterator<B*>(pa+1),
> pb);
>
I tried but I stumped over the following problem. I present it in an
isolated form.
template<class wrapped_t>
struct wrapper {
wrapped_t x;
wrapper(wrapped_t c): x(c) {
}
wrapper &operator =(wrapped_t c) {
x = c;
return *this;
}
operator wrapped_t &(void) {
return x;
}
operator wrapped_t const &(void) const {
return x;
}
};
inline void test_wrapper(void) {
wrapper<int> x(00);
wrapper<int *> y(00);
++x;
++y; // error C2675: unary '++' : 'wrapper<wrapped_t>' does not define this
operator or a conversion to a type acceptable to the predefined operator
}
Comeau compiles it without an error but MSVC prohibits me from incrementing
the pointer whereas it allows me to increment the integer. It does not make
sense.
.
- Follow-Ups:
- Re: downcast copy algorithm request
- From: Doug Harrison [MVP]
- Re: downcast copy algorithm request
- References:
- downcast copy algorithm request
- From: Christopher Yeleighton
- Re: downcast copy algorithm request
- From: Doug Harrison [MVP]
- downcast copy algorithm request
- Prev by Date: Re: downcast copy algorithm request
- Next by Date: Re: downcast copy algorithm request
- Previous by thread: Re: downcast copy algorithm request
- Next by thread: Re: downcast copy algorithm request
- Index(es):
Relevant Pages
|