Boost logo

Boost Users :

Subject: Re: [Boost-users] C++ guru required!
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2012-02-27 00:26:09


> > Sorry it took me a bit longer, but here are my ideas....
> > Code from Slide 12 of Andrei's presentation at Going Native 2012:
> >
> >
> > template<class T>
> > struct container
> > {
> > ...
> > static if(debug_mode<T>::value)
> > {
> > class const_iterator { ... };
> > static if(std::is_const<T>::value)
> > {
> > typedef const_iterator iterator;
> > }
> > else
> > {
> > class iterator { ... };
> > }
> > }
> > else
> > {
> > class const_iterator { ... };
> > clas iterator { ... };
> > }
> > };
> >
> and my view would be that removing the "static" wouldn't change
> anything in the program - so why is it necessary.
>
> > template<class PointerWrapper>
> > struct grab_pointer_type
> > {
> > static if(has_element_type<PointerWrapper>::value)
> > {
> > typedef typename PointerWrapper::element_type pointer_type;
> > }
> > else
> > {
> > typedef typename PointerWrapper::value_type pointer_type;
> > }
> > };
>
> also in this example, removing the static wouldn't change the
> program in any way.

But the static_if is being used at class scope here - regular
if statements cannot be used at class scope!

Regards,
Nate
                                               


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net