Skip to content

Commit

Permalink
Added some fixes as attempt to compile in C++03 (failed)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Małecki committed Jul 11, 2024
1 parent a49bdd9 commit 8b4d44c
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions srtcore/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -624,18 +624,18 @@ inline TR& operator<<(TR& ot, const fmt_sender_proxy& formatter)
template <class TYPE>
class fmt_delayed_sender_proxy
{
std::stringstream os;
mutable std::ostringstream os;
TYPE value_cache;
public:
explicit fmt_delayed_sender_proxy(const TYPE& v): value_cache(v)
{
}

template <class OUTSTR>
void sendto(OUTSTR& stream)
void sendto(OUTSTR& stream) const
{
os << value_cache;
stream << os.rdbuf();
stream << os.str();
}

template<class ValueType>
Expand All @@ -646,7 +646,7 @@ class fmt_delayed_sender_proxy
}

template<class TR>
friend TR& operator<<(TR& ot, fmt_delayed_sender_proxy& formatter)
friend TR& operator<<(TR& ot, const fmt_delayed_sender_proxy& formatter)
{
formatter.sendto(ot);
return ot;
Expand Down Expand Up @@ -833,7 +833,15 @@ class UniquePtr: public std::auto_ptr<T>
template <class Arg1>
inline std::string Sprint(const Arg1& arg)
{
return fmt_sender_proxy(arg).str();
return fmt(arg).str();
}

template <class Arg1, class Arg2>
inline std::string Sprint(const Arg1& arg, const Arg2& arg2)
{
std::stringstream out;
out << arg << arg2;
return out.str();
}

template<typename Map, typename Key>
Expand Down Expand Up @@ -1312,7 +1320,11 @@ inline std::string BufferStamp(const char* mem, size_t size)
}

// Convert to hex string
//return (std::ostringstream() << setfill('0') << setw(8) << hex << uppercase << sum).str();
return (srt::fmt(sum) << setfill('0') << setw(8) << hex << uppercase).str();
// std::ostringstream os;
// os << setfill('0') << setw(8) << hex << uppercase << sum;
// return os.str();

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
}

template <class OutputIterator>
Expand Down

0 comments on commit 8b4d44c

Please sign in to comment.