Menu

vector_range on const vector

2013-06-13
2013-08-19
  • Peter Burka

    Peter Burka - 2013-06-13

    It appears to be impossible to create a vector_range on a const vector.

    Since there's no const constructor in C++, it's not immediately obvious to me how this would be implemented -- maybe some clever template trick.

    I can also cast away the constness, but that's ugly.

    Any suggestions?

     
    • Peter Burka

      Peter Burka - 2013-06-14

      It occurs to me that I can probably do vector_range<const vector>. This would explain why the template argument to vector_range is a VectorType. I'll give this a try.

       
      • Peter Burka

        Peter Burka - 2013-06-14

        Unfortunately that doesn't seem to work. Is there a recommended work around for this?

         
  • Karl Rupp

    Karl Rupp - 2013-08-19

    Hi Peter,

    sorry for the HUGE delay, apparently my email notification settings for new forum posts got reset when sourceforge updated the UI :-/

    I'll have a look at the const vector issue and let you know. const_cast<> is certainly ugly, yet I'm not sure whether there is a 100% clean way of dealing with this.

    Best regards,
    Karli

     

Log in to post a comment.