Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > having an alter...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 44176 of 48044
Post > Topic >>

having an alternate function based on some trait .. exactly how to do

by abir <abirbasak@[EMAIL PROTECTED] > Mar 28, 2008 at 03:56 AM

HI,
  i have a class like this (simplified version)
  template<typename C>
  class range_view{
    public: /// all of the container typedefs.
      iterator begin(){
        return cont_.begin()+range_.first;
      }
      iterator end(){
        return cont_.begin()+range_.second;
      }
    private:
     C* cont_;
    std::pait<size_type,size_type> range_;
  };

now i want to handle begin & end different way some container. At
present i copied it again written as,

template<typename C, typename M = C::remove_aware>
  class range_view{
    public: /// all of the container typedefs.
      iterator begin(){
        return cont_->begin()+range_.first+cont_->remove_count();
      }
      iterator end(){
        return cont_->begin()+range_.second+cont_->remove_count();
      }
    private:
     C* cont_;
    std::pait<size_type,size_type> range_;
  };
so, instead of having a full class for a remove aware container, i
want just begin & end should match with the trait...
anyways can it be done using SFINAE  ?
thanks
abir
 




 3 Posts in Topic:
having an alternate function based on some trait .. exactly how
abir <abirbasak@[EMAIL  2008-03-28 03:56:49 
Re: having an alternate function based on some trait .. exactly
gnuyuva <gnuyuva@[EMAI  2008-03-28 04:48:11 
Re: having an alternate function based on some trait .. exactly
abir <abirbasak@[EMAIL  2008-03-28 08:03:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Oct 15 22:43:20 CDT 2008.