Discontinue manual inline hinting

Compiler knows better than we do.

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2022-02-03 13:34:00 +01:00
parent 90de5d7140
commit b2e4c7dc4a

View File

@ -24,7 +24,7 @@ namespace stdex {
/// - \c false otherwise /// - \c false otherwise
/// ///
template <class T_ID> template <class T_ID>
inline _Success_(return) bool read_id(_In_ std::istream& stream, _Out_ T_ID &id, _In_opt_ std::streamoff end = (std::streamoff)-1) _Success_(return) bool read_id(_In_ std::istream& stream, _Out_ T_ID &id, _In_opt_ std::streamoff end = (std::streamoff)-1)
{ {
if (end == (std::streamoff)-1 || stream.tellg() < end) { if (end == (std::streamoff)-1 || stream.tellg() < end) {
stream.read((char*)&id, sizeof(id)); stream.read((char*)&id, sizeof(id));
@ -44,7 +44,7 @@ namespace stdex {
/// - \c false otherwise /// - \c false otherwise
/// ///
template <class T_SIZE, unsigned int ALIGN> template <class T_SIZE, unsigned int ALIGN>
inline bool ignore(_In_ std::istream& stream) bool ignore(_In_ std::istream& stream)
{ {
// Read record size. // Read record size.
T_SIZE size; T_SIZE size;
@ -72,7 +72,7 @@ namespace stdex {
/// - \c false otherwise /// - \c false otherwise
/// ///
template <class T_ID, class T_SIZE, unsigned int ALIGN> template <class T_ID, class T_SIZE, unsigned int ALIGN>
inline bool find(_In_ std::istream& stream, _In_ T_ID id, _In_opt_ std::streamoff end = (std::streamoff)-1) bool find(_In_ std::istream& stream, _In_ T_ID id, _In_opt_ std::streamoff end = (std::streamoff)-1)
{ {
T_ID _id; T_ID _id;
@ -100,7 +100,7 @@ namespace stdex {
/// \returns Position of the record header start in \p stream. Save for later \c close call. /// \returns Position of the record header start in \p stream. Save for later \c close call.
/// ///
template <class T_ID, class T_SIZE> template <class T_ID, class T_SIZE>
inline std::streamoff open(_In_ std::ostream& stream, _In_ T_ID id) std::streamoff open(_In_ std::ostream& stream, _In_ T_ID id)
{ {
std::streamoff start = stream.tellp(); std::streamoff start = stream.tellp();
@ -126,7 +126,7 @@ namespace stdex {
/// \returns Position of the record end in \p stream /// \returns Position of the record end in \p stream
/// ///
template <class T_ID, class T_SIZE, unsigned int ALIGN> template <class T_ID, class T_SIZE, unsigned int ALIGN>
inline std::streamoff close(_In_ std::ostream& stream, _In_ std::streamoff start) std::streamoff close(_In_ std::ostream& stream, _In_ std::streamoff start)
{ {
std::streamoff end = stream.tellp(); std::streamoff end = stream.tellp();
T_SIZE T_SIZE
@ -162,7 +162,7 @@ namespace stdex {
/// ///
/// \param[in] d Reference to record data /// \param[in] d Reference to record data
/// ///
inline record(_In_ T &d) : data(d) {} record(_In_ T &d) : data(d) {}
/// ///
@ -170,7 +170,7 @@ namespace stdex {
/// ///
/// \param[in] d Reference to record data /// \param[in] d Reference to record data
/// ///
inline record(_In_ const T &d) : data((T&)d) {} record(_In_ const T &d) : data((T&)d) {}
/// ///
@ -180,7 +180,7 @@ namespace stdex {
/// ///
/// \returns A const reference to this struct /// \returns A const reference to this struct
/// ///
inline const record<T, T_ID, T_SIZE, ALIGN>& operator =(_In_ const record<T, T_ID, T_SIZE, ALIGN> &r) const record<T, T_ID, T_SIZE, ALIGN>& operator =(_In_ const record<T, T_ID, T_SIZE, ALIGN> &r)
{ {
data = r.data; data = r.data;
return *this; return *this;
@ -194,7 +194,7 @@ namespace stdex {
/// ///
/// \returns Position of the record header start in \p stream. Save for later \c close call. /// \returns Position of the record header start in \p stream. Save for later \c close call.
/// ///
static inline std::streamoff open(_In_ std::ostream& stream) static std::streamoff open(_In_ std::ostream& stream)
{ {
return stdex::idrec::open<T_ID, T_SIZE>(stream, id); return stdex::idrec::open<T_ID, T_SIZE>(stream, id);
} }
@ -208,7 +208,7 @@ namespace stdex {
/// ///
/// \returns Position of the record end in \p stream /// \returns Position of the record end in \p stream
/// ///
static inline std::streamoff close(_In_ std::ostream& stream, _In_ std::streamoff start) static std::streamoff close(_In_ std::ostream& stream, _In_ std::streamoff start)
{ {
return stdex::idrec::close<T_ID, T_SIZE, ALIGN>(stream, start); return stdex::idrec::close<T_ID, T_SIZE, ALIGN>(stream, start);
} }
@ -224,7 +224,7 @@ namespace stdex {
/// - \c true when found /// - \c true when found
/// - \c false otherwise /// - \c false otherwise
/// ///
static inline bool find(_In_ std::istream& stream, _In_opt_ std::streamoff end = (std::streamoff)-1) static bool find(_In_ std::istream& stream, _In_opt_ std::streamoff end = (std::streamoff)-1)
{ {
return stdex::idrec::find<T_ID, T_SIZE, ALIGN>(stream, id, end); return stdex::idrec::find<T_ID, T_SIZE, ALIGN>(stream, id, end);
} }
@ -246,7 +246,7 @@ namespace stdex {
/// \returns The stream \p stream /// \returns The stream \p stream
/// ///
template <class T, class T_ID, class T_SIZE, unsigned int ALIGN> template <class T, class T_ID, class T_SIZE, unsigned int ALIGN>
inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const stdex::idrec::record<T, T_ID, T_SIZE, ALIGN> r) std::ostream& operator <<(_In_ std::ostream& stream, _In_ const stdex::idrec::record<T, T_ID, T_SIZE, ALIGN> r)
{ {
// Parameter r does not need to be passed by reference. It has only one field (data), which is a reference itself already. The id field is static anyway. // Parameter r does not need to be passed by reference. It has only one field (data), which is a reference itself already. The id field is static anyway.
@ -268,7 +268,7 @@ inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const stdex::id
/// \returns The stream \p stream /// \returns The stream \p stream
/// ///
template <class T, class T_ID, class T_SIZE, unsigned int ALIGN> template <class T, class T_ID, class T_SIZE, unsigned int ALIGN>
inline std::istream& operator >>(_In_ std::istream& stream, _In_ stdex::idrec::record<T, T_ID, T_SIZE, ALIGN> r) std::istream& operator >>(_In_ std::istream& stream, _In_ stdex::idrec::record<T, T_ID, T_SIZE, ALIGN> r)
{ {
// Parameter r does not need to be passed by reference. It has only one field (data), which is a reference itself already. The id field is static anyway. // Parameter r does not need to be passed by reference. It has only one field (data), which is a reference itself already. The id field is static anyway.