Re: traits help
From: Grzegorz Sakrejda (grejdanospam_at_pacbell.net)
Date: 10/24/03
- Next message: lilburne: "Re: A fatal exception"
- Previous message: Victor Bazarov: "Re: const and valarray reference"
- In reply to: Rex_chaos: "traits help"
- Next in thread: Rex_chaos: "Re: traits help"
- Reply: Rex_chaos: "Re: traits help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 23 Oct 2003 22:01:42 GMT
On 23 Oct 2003 13:22:26 -0700, Rex_chaos <rex_chaos@21cn.com> wrote:
> Hi there,
>
>
> //Iter is an iterator
>
> template <typename T, typename tag=non_const_iterator_tag>
> class Iter
> {
> typedef typename Iter_traits<T, tag>::value_type value_type;
> typedef typename Iter_traits<T, tag>::reference reference;
> public:
> Iter(T *c) :cont(c) {...}
>
> // copy constructor to shift the non-const iterator to const
> iterator
> Iter(const Iter<T, non_const_iterator_tag>& it) :cont(it.c)
> {...}
this part looks suspicious. I don't know what it.c is but it is probably
private and
const_iterator do not have access to it .
>
> private:
> T *cont;
> };
>
> // Container is a container.
>
> I don't know why. It seems that it's due to the copy constructor.
> Please help!
>
>
> BTW, if I define begin() outside the class. e.g.
>
> template <typename T>
> Container<T>::iterator Container<T>::begin(void)
> {
> ...
> }
>
> The compiler will give a warning: `typename Container<T>::iterator' is
> implicitly a typename
> mplicit typename is deprecated, please see the documentation for
> details
>
> Is that anything wrong? Should I do something to prevent that warning?
>
> Thanks in advance.
>
-- grzegorz
- Next message: lilburne: "Re: A fatal exception"
- Previous message: Victor Bazarov: "Re: const and valarray reference"
- In reply to: Rex_chaos: "traits help"
- Next in thread: Rex_chaos: "Re: traits help"
- Reply: Rex_chaos: "Re: traits help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]