MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / takeOwnership

Method takeOwnership

unittests/catch.hpp:9683–9690  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9681 }
9682
9683 void StringRef::takeOwnership() {
9684 if( !isOwned() ) {
9685 m_data = new char[m_size+1];
9686 memcpy( m_data, m_start, m_size );
9687 m_data[m_size] = '\0';
9688 m_start = m_data;
9689 }
9690 }
9691 auto StringRef::substr( size_type start, size_type size ) const noexcept -> StringRef {
9692 if( start < m_size )
9693 return StringRef( m_start+start, size );

Callers 1

c_strMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected