… | |
… | |
14 | slice_view (Container const &container, size_t offset) |
14 | slice_view (Container const &container, size_t offset) |
15 | : container (container) |
15 | : container (container) |
16 | , offset (offset) |
16 | , offset (offset) |
17 | { |
17 | { |
18 | if (container.size () < offset) |
18 | if (container.size () < offset) |
19 | throw "slice out of bounds"; |
19 | throw std::logic_error ("slice out of bounds"); |
20 | else if (container.size () == offset) |
20 | else if (container.size () == offset) |
21 | throw "empty slice interval"; |
21 | throw std::logic_error ("empty slice interval"); |
22 | } |
22 | } |
23 | |
23 | |
24 | const_iterator begin () const { return container.begin () + offset; } |
24 | const_iterator begin () const { return container.begin () + offset; } |
25 | const_iterator end () const { return container.end (); } |
25 | const_iterator end () const { return container.end (); } |
26 | |
26 | |