diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-06 10:25:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-06 15:18:33 +0200 |
commit | 4d830ab33c75dc07d77796d422d909c235c2c127 (patch) | |
tree | 40c3fcb363617246dbb5d92c0b94bc5e3e40acdf /o3tl | |
parent | bc3e0121b47cc601575b0a49f6ba4959130cf96e (diff) |
const correctness in o3tl::array_view
Change-Id: I44c1ace97ae44069c5a0c6a247aa8a0b49896ad3
Reviewed-on: https://gerrit.libreoffice.org/41985
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'o3tl')
-rw-r--r-- | o3tl/qa/test-array_view.cxx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/o3tl/qa/test-array_view.cxx b/o3tl/qa/test-array_view.cxx index ab97d7de49c5..b82aa8cd1bf4 100644 --- a/o3tl/qa/test-array_view.cxx +++ b/o3tl/qa/test-array_view.cxx @@ -28,7 +28,7 @@ private: void testOperations() { int const some_data[] { 1, 2, 3 }; - o3tl::array_view<int> v(some_data); + o3tl::array_view<int const> v(some_data); CPPUNIT_ASSERT_EQUAL(1, *v.begin()); CPPUNIT_ASSERT_EQUAL( @@ -63,12 +63,18 @@ private: { int const d1[] { 1, 2 }; int const d2[] { 3, 4, 5, 6 }; - o3tl::array_view<int> v1( d1 ); - o3tl::array_view<int> v2( d2 ); + o3tl::array_view<int const> v1( d1 ); + o3tl::array_view<int const> v2( d2 ); v1.swap(v2); CPPUNIT_ASSERT_EQUAL(o3tl::array_view<int>::size_type(4), v1.size()); CPPUNIT_ASSERT_EQUAL(o3tl::array_view<int>::size_type(2), v2.size()); } + { + int d1[] { 1, 2, 3 }; + o3tl::array_view<int> v1(d1); + o3tl::array_view<int const> v2; + v2 = v1; // the special operator= + } } }; |