Skip to content

Commit

Permalink
Make the generator compile with C++17
Browse files Browse the repository at this point in the history
- remove unneeded inheritance from binary_function
- replace auto_ptr with unique_ptr (do not use make_unique, which is not in C++11)
  • Loading branch information
mrbean-bremen committed Oct 27, 2023
1 parent 9d691d1 commit aefd2d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions generator/parser/rpp/pp-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,19 @@ inline bool comment_p (InputIterator _first, InputIterator _last) /*const*/
return (*_first == '/' || *_first == '*');
}

struct _Compare_string: public std::binary_function<bool, pp_fast_string const *, pp_fast_string const *>
struct _Compare_string
{
inline bool operator () (pp_fast_string const *__lhs, pp_fast_string const *__rhs) const
{ return *__lhs < *__rhs; }
};

struct _Equal_to_string: public std::binary_function<bool, pp_fast_string const *, pp_fast_string const *>
struct _Equal_to_string
{
inline bool operator () (pp_fast_string const *__lhs, pp_fast_string const *__rhs) const
{ return *__lhs == *__rhs; }
};

struct _Hash_string: public std::unary_function<std::size_t, pp_fast_string const *>
struct _Hash_string
{
inline std::size_t operator () (pp_fast_string const *__s) const
{
Expand Down
3 changes: 2 additions & 1 deletion generator/typesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ bool Handler::startElement(const QString &, const QString &n,
return importFileElement(atts);
}

std::auto_ptr<StackElement> element(new StackElement(current));
std::unique_ptr<StackElement> element(new StackElement(current));

if (!tagNames.contains(tagName)) {
m_error = QString("Unknown tag name: '%1'").arg(tagName);
Expand Down Expand Up @@ -1502,6 +1502,7 @@ TypeDatabase::TypeDatabase() : m_suppressWarnings(true)
bool TypeDatabase::parseFile(const QString &filename, bool generate)
{
QFile file(filename);

Q_ASSERT(file.exists());
QXmlInputSource source(&file);

Expand Down

0 comments on commit aefd2d1

Please sign in to comment.