diff --git a/src/OpenFOAM/primitives/strings/string/string.C b/src/OpenFOAM/primitives/strings/string/string.C index 9059a99e7a..ef3fc146f5 100644 --- a/src/OpenFOAM/primitives/strings/string/string.C +++ b/src/OpenFOAM/primitives/strings/string/string.C @@ -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& str) +: + std::string(str.begin(), str.end()) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::string::size_type Foam::string::count(const char c) const diff --git a/src/OpenFOAM/primitives/strings/string/string.H b/src/OpenFOAM/primitives/strings/string/string.H index 4a54be458a..4ba576b0e9 100644 --- a/src/OpenFOAM/primitives/strings/string/string.H +++ b/src/OpenFOAM/primitives/strings/string/string.H @@ -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 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&); + //- Construct as copy of specified number of characters inline string(const char*, const size_type);