How to check whether a container is stable

前端 未结 1 1182
情书的邮戳
情书的邮戳 2021-01-04 02:56

std::vector is an unstable container, i.e. by resizing the vector, iterators might become invalidated. In contrast, std::list or boost::conta

1条回答
  •  借酒劲吻你
    2021-01-04 03:21

    I don't think there is anything available providing such information, but you could write your own trait. However, you will need to specialize it for every stable container that may be used, which is perhaps not an option.

    #include 
    
    #include 
    #include 
    #include 
    #include 
    
    template