Skip to content
Snippets Groups Projects
Commit 0cec0ba5 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

use as_const

parent 32b1dcc3
No related branches found
No related tags found
1 merge request!44Advance to C++17
......@@ -127,17 +127,6 @@ inline ptr_value < T > move_copy ( const T & param ) {
return ptr_value < T > ( param );
}
 
// TODO remove after switching to c++17 (as_const)
template < class T >
inline const T & make_const ( T & ptr ) {
return static_cast < const T & > ( ptr );
}
template < class T >
inline const T & make_const ( const T & ptr ) {
return ptr;
}
} /* namespace ext */
 
#endif /* __UTILITY_HPP_ */
......@@ -26,11 +26,11 @@ void SharedPtrTest::testSharedPtr1() {
CPPUNIT_ASSERT(moves == 0);
CPPUNIT_ASSERT(copies == 0);
 
ext::make_const(two).get();
std::as_const(two).get();
 
ext::cow_shared_ptr<SharedPtrTest::Moveable> three(std::move ( two ) );
 
ext::make_const(three).get();
std::as_const(three).get();
 
CPPUNIT_ASSERT(!one.unique());
CPPUNIT_ASSERT(moves == 0);
......@@ -61,11 +61,11 @@ void SharedPtrTest::testSharedPtr2() {
CPPUNIT_ASSERT(moves == 0);
CPPUNIT_ASSERT(copies == 0);
 
ext::make_const(two).get();
std::as_const(two).get();
 
ext::cow_shared_ptr<SharedPtrTest::Moveable2> three(std::move ( two ) );
 
ext::make_const(three).get();
std::as_const(three).get();
 
CPPUNIT_ASSERT(!one.unique());
CPPUNIT_ASSERT(moves == 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment