MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / rpad

Function rpad

benchmarks/dlib/string/string.h:694–713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

692 typename alloc
693 >
694 const std::basic_string<charT,traits,alloc> rpad (
695 const std::basic_string<charT,traits,alloc>& str,
696 long pad_length,
697 const std::basic_string<charT,traits,alloc>& pad_string
698 )
699 {
700 typedef std::basic_string<charT,traits,alloc> string;
701 // if str is too big then just return str
702 if (pad_length <= static_cast<long>(str.size()))
703 return str;
704
705 // make the string we will padd onto the string
706 string P;
707 while (P.size() < pad_length - str.size())
708 P += pad_string;
709 P = P.substr(0,pad_length - str.size());
710
711 // return the padded string
712 return str + P;
713 }
714
715 template <
716 typename charT,

Callers 1

padFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected