Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around missing ostream operator #15

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion include/ptlib/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,25 @@ template <class T> class PBaseArray : public PAbstractArray
}
//@}

private:
template<typename X>
void streamOut(ostream & stream, const X & t) const
{
stream << t;
}

template<>
void streamOut<wchar_t>(ostream & stream, const wchar_t & t) const
{
stream << std::to_string(t);
}

protected:
virtual void PrintElementOn(
ostream & stream,
PINDEX index
) const {
stream << GetAt(index);
streamOut(stream, GetAt(index));
}

PBaseArray(PContainerReference & reference) : PAbstractArray(reference, sizeof(T)) { }
Expand Down
2 changes: 1 addition & 1 deletion src/ptclib/asner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@ void PASN_BMPString::PrintOn(ostream & strm) const
PINDEX j;
for (j = 0; j < 8; j++)
if (i+j < sz)
strm << setw(4) << value[i+j] << ' ';
strm << setw(4) << std::to_string(value[i+j]) << ' ';
else
strm << " ";
strm << " ";
Expand Down