Skip to content
Snippets Groups Projects
Commit ad50cfaf authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Jakub Klinkovský
Browse files

Fixing templated constructor of String, make it explicit + other fixes in String.

parent d437af27
No related branches found
No related tags found
1 merge request!10Periodic BC in distributed grid
This commit is part of merge request !10. Comments created here will be created in the context of that merge request.
......@@ -43,7 +43,7 @@ runBlasBenchmarks( Benchmark & benchmark,
metadata );
for( std::size_t size = minSize; size <= maxSize; size *= 2 ) {
benchmark.setMetadataColumns( Benchmark::MetadataColumns({
{"size", size},
{"size", String( size ) },
} ));
benchmarkArrayOperations< Real >( benchmark, loops, size );
}
......@@ -53,7 +53,7 @@ runBlasBenchmarks( Benchmark & benchmark,
metadata );
for( std::size_t size = minSize; size <= maxSize; size *= sizeStepFactor ) {
benchmark.setMetadataColumns( Benchmark::MetadataColumns({
{"size", size},
{ "size", String( size ) },
} ));
benchmarkVectorOperations< Real >( benchmark, loops, size );
}
......@@ -63,9 +63,9 @@ runBlasBenchmarks( Benchmark & benchmark,
metadata );
for( std::size_t size = minSize; size <= maxSize; size *= 2 ) {
benchmark.setMetadataColumns( Benchmark::MetadataColumns({
{"rows", size},
{"columns", size},
{"elements per row", elementsPerRow},
{"rows", String( size ) },
{"columns", String( size ) },
{"elements per row", String( elementsPerRow ) },
} ));
benchmarkSpmvSynthetic< Real >( benchmark, loops, size, elementsPerRow );
}
......
......@@ -29,10 +29,10 @@ String::String()
setString( nullptr );
}
String::String( char* c, int prefix_cut_off, int sufix_cut_off )
String::String( const char* str )
: string( nullptr ), length( 0 )
{
setString( c, prefix_cut_off, sufix_cut_off );
setString( str );
}
String::String( const char* c, int prefix_cut_off, int sufix_cut_off )
......
......@@ -37,35 +37,36 @@ class String
public:
//! Basic constructor
String();
//! Constructor from const char*
String( const char* str );
//! Constructor with char pointer
/*! @param prefix_cut_off says length of the prefix that is going to be omitted and
@param sufix_cut_off says the same about sufix.
*/
String( const char* c,
int prefix_cut_off = 0,
int sufix_cut_off = 0 );
String( char* c,
int prefix_cut_off = 0,
int prefix_cut_off,
int sufix_cut_off = 0 );
static String getType();
//! Copy constructor
String( const String& str );
//! Convert anything to a string
template< typename T >
explicit
String( T value )
: string( nullptr ), length( 0 )
{
setString( convertToString( value ).getString() );
std::stringstream str;
str << value;
setString( str.str().data() );
}
//! Destructor
~String();
static String getType();
//! Return length of the string
int getLength() const;
......
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