libZRCola: Include stdex/idrec.h only after << and >> are overloaded

gcc precompiles templates.  When << and >> operators of our datatypes are
not overloaded at the time <stdex/idrec.h> is #included yet, gcc will
seek/look for currently available << and >> operators when reaching
std::ostream and std::istream templates.

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
2022-09-15 12:01:11 +02:00
parent bd01e250b2
commit 9a307978b5
8 changed files with 43 additions and 38 deletions

View File

@@ -8,7 +8,20 @@
#include "common.h"
#include "language.h"
#include <stdex/idrec.h>
namespace ZRCola {
class translation_db;
}
///
/// Reads translation database from a stream
///
/// \param[in ] stream Input stream
/// \param[out] db Translation database
///
/// \returns The stream \p stream
///
inline std::istream& operator >>(_In_ std::istream& stream, _Out_ ZRCola::translation_db &db);
#include <algorithm>
#include <istream>
#include <ostream>
@@ -320,9 +333,6 @@ namespace ZRCola {
};
typedef stdex::idrec::record<translation_db, recordid_t, 0x4e5254 /*"TRN"*/, recordsize_t, ZRCOLA_RECORD_ALIGN> translation_rec;
///
/// Translation set database
///
@@ -436,9 +446,6 @@ namespace ZRCola {
};
typedef stdex::idrec::record<transet_db, recordid_t, 0x455354 /*"TSE"*/, recordsize_t, ZRCOLA_RECORD_ALIGN> transet_rec;
///
/// Translation sequence database
///
@@ -608,9 +615,6 @@ namespace ZRCola {
data .clear();
}
};
typedef stdex::idrec::record<transeq_db, recordid_t, 0x515354 /*"TSQ"*/, recordsize_t, ZRCOLA_RECORD_ALIGN> transeq_rec;
};