string: Added construction from UList<char>

This commit is contained in:
Henry Weller
2020-03-19 16:44:28 +00:00
parent 4c08b463fd
commit 28b2f4cd8e
2 changed files with 16 additions and 3 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ License
#include "string.H"
#include "stringOps.H"
#include "UList.H"
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
@ -34,6 +34,14 @@ int Foam::string::debug(Foam::debug::debugSwitch(string::typeName, 0));
const Foam::string Foam::string::null;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::string::string(const UList<char>& str)
:
std::string(str.begin(), str.end())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::string::size_type Foam::string::count(const char c) const

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -67,6 +67,8 @@ Istream& operator>>(Istream&, string&);
Ostream& operator<<(Ostream&, const string&);
Ostream& operator<<(Ostream&, const std::string&);
template<class T>
class UList;
/*---------------------------------------------------------------------------*\
Class string Declaration
@ -115,6 +117,9 @@ public:
//- Construct as copy of character array
inline string(const char*);
//- Construct as copy of UList of character
string(const UList<char>&);
//- Construct as copy of specified number of characters
inline string(const char*, const size_type);