Skip to content

Commit 5335692

Browse files
author
Clement Champetier
committed
JsonWriter: fix compilation with gcc
* The error was: 'explicit specialization in non-namespace scope'. * Solution: move the specializations of the member templates outside of the class body.
1 parent 184a183 commit 5335692

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/AvTranscoder/properties/JsonWriter.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ std::string JsonStreamWriter::escapeJsonString(const std::string& input)
1818
return ss.str();
1919
}
2020

21+
template<>
22+
JsonObjectStreamWriter& JsonObjectStreamWriter::operator<<(const std::pair<const char *, const char*> pair)
23+
{
24+
std::string first(pair.first);
25+
std::string second(pair.second);
26+
addSep() << escapeJsonString(first).c_str() << ':' << escapeJsonString(second).c_str();
27+
return *this;
28+
}
29+
2130
template <>
2231
JsonStreamWriter& JsonStreamWriter::operator<<(bool value)
2332
{

src/AvTranscoder/properties/JsonWriter.hpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,13 @@ class AvExport JsonObjectStreamWriter : public JsonStreamWriter
7979
return *this;
8080
}
8181

82-
template<>
83-
JsonObjectStreamWriter& operator<<(const std::pair<const char *, const char*> pair)
84-
{
85-
std::string first(pair.first);
86-
std::string second(pair.second);
87-
addSep() << escapeJsonString(first).c_str() << ':' << escapeJsonString(second).c_str();
88-
return *this;
89-
}
90-
9182
protected:
9283
virtual std::ostream& finish() { return stream << '}'; }
9384
};
9485

86+
template<>
87+
JsonObjectStreamWriter& JsonObjectStreamWriter::operator<<(const std::pair<const char *, const char*> pair);
88+
9589
/**
9690
* @brief Write an array to a stream.
9791
*/

0 commit comments

Comments
 (0)