mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
Made more of StringRef noexcept
This commit is contained in:
parent
f9ce8fd03b
commit
03afbdfec9
@ -17,11 +17,11 @@ namespace Catch {
|
|||||||
|
|
||||||
StringRef StringRef::s_emptyStringRef = "";
|
StringRef StringRef::s_emptyStringRef = "";
|
||||||
|
|
||||||
StringRef::StringRef()
|
StringRef::StringRef() noexcept
|
||||||
: StringRef( s_emptyStringRef )
|
: StringRef( s_emptyStringRef )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
StringRef::StringRef( StringRef const& other )
|
StringRef::StringRef( StringRef const& other ) noexcept
|
||||||
: m_start( other.m_start ),
|
: m_start( other.m_start ),
|
||||||
m_size( other.m_size ),
|
m_size( other.m_size ),
|
||||||
m_data( other.m_data )
|
m_data( other.m_data )
|
||||||
@ -38,12 +38,12 @@ namespace Catch {
|
|||||||
other.m_data = nullptr;
|
other.m_data = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringRef::StringRef( char const* rawChars )
|
StringRef::StringRef( char const* rawChars ) noexcept
|
||||||
: m_start( rawChars ),
|
: m_start( rawChars ),
|
||||||
m_size( std::strlen( rawChars ) )
|
m_size( std::strlen( rawChars ) )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
StringRef::StringRef( char const* rawChars, size_type size )
|
StringRef::StringRef( char const* rawChars, size_type size ) noexcept
|
||||||
: m_start( rawChars ),
|
: m_start( rawChars ),
|
||||||
m_size( size )
|
m_size( size )
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ namespace Catch {
|
|||||||
size = rawSize;
|
size = rawSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringRef::StringRef( String const& other )
|
StringRef::StringRef( String const& other ) noexcept
|
||||||
: m_start( other.c_str() ),
|
: m_start( other.c_str() ),
|
||||||
m_size( other.size() ),
|
m_size( other.size() ),
|
||||||
m_data( nullptr )
|
m_data( nullptr )
|
||||||
@ -71,7 +71,7 @@ namespace Catch {
|
|||||||
m_data->release();
|
m_data->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto StringRef::operator = ( StringRef other ) -> StringRef& {
|
auto StringRef::operator = ( StringRef other ) noexcept -> StringRef& {
|
||||||
swap( other );
|
swap( other );
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -36,16 +36,16 @@ namespace Catch {
|
|||||||
void takeOwnership();
|
void takeOwnership();
|
||||||
|
|
||||||
public: // construction/ assignment
|
public: // construction/ assignment
|
||||||
StringRef();
|
StringRef() noexcept;
|
||||||
StringRef( StringRef const& other );
|
StringRef( StringRef const& other ) noexcept;
|
||||||
StringRef( StringRef&& other ) noexcept;
|
StringRef( StringRef&& other ) noexcept;
|
||||||
StringRef( char const* rawChars );
|
StringRef( char const* rawChars ) noexcept;
|
||||||
StringRef( char const* rawChars, size_type size );
|
StringRef( char const* rawChars, size_type size ) noexcept;
|
||||||
StringRef( String const& other );
|
StringRef( String const& other ) noexcept;
|
||||||
StringRef( String&& other ) noexcept;
|
StringRef( String&& other ) noexcept;
|
||||||
~StringRef() noexcept;
|
~StringRef() noexcept;
|
||||||
|
|
||||||
auto operator = ( StringRef other ) -> StringRef&;
|
auto operator = ( StringRef other ) noexcept -> StringRef&;
|
||||||
|
|
||||||
void swap( StringRef& other ) noexcept;
|
void swap( StringRef& other ) noexcept;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user