Removed rangechecked_cast was not working as I hoped.

This commit is contained in:
eelke 2019-11-30 16:11:12 +01:00
parent 404d4c856a
commit 817a371220
6 changed files with 4 additions and 58 deletions

View file

@ -1,5 +1,4 @@
#include "BackupFormatModel.h"
#include "rangechecked_cast.h"
#include <vector>
namespace {
@ -61,7 +60,7 @@ BackupFormatModel::BackupFormatModel(QObject *parent)
int BackupFormatModel::rowCount(const QModelIndex &) const
{
int size = rangechecked_cast<int>(g_BackupFormats.size());
int size = static_cast<int>(g_BackupFormats.size());
return size;
}
@ -79,7 +78,7 @@ QVariant BackupFormatModel::data(const QModelIndex &index, int role) const
const int col = index.column();
if (role == Qt::DisplayRole) {
const auto &item = g_BackupFormats.at(rangechecked_cast<size_t>(row));
const auto &item = g_BackupFormats.at(static_cast<size_t>(row));
switch (col) {
case ColumnShort:
result = item.shortFlag;
@ -93,7 +92,7 @@ QVariant BackupFormatModel::data(const QModelIndex &index, int role) const
}
}
else if (role == Qt::ToolTipRole) {
const auto &item = g_BackupFormats.at(rangechecked_cast<size_t>(row));
const auto &item = g_BackupFormats.at(static_cast<size_t>(row));
result = item.description;
}
}

View file

@ -1,6 +1,5 @@
#include "ExplainTreeModelItem.h"
#include "json/json.h"
#include "rangechecked_cast.h"
#include <limits>
namespace {
@ -111,7 +110,7 @@ ExplainTreeModelItemPtr ExplainTreeModelItem::child(int row)
int ExplainTreeModelItem::childCount() const
{
return rangechecked_cast<int>(m_childItems.size());
return static_cast<int>(m_childItems.size());
}
//int ExplainTreeModelItem::columnCount() const

View file

@ -56,7 +56,6 @@ HEADERS += PasswordManager.h \
SqlAstSelectListEntry.h \
SqlAstSelect.h \
SqlAstExpression.h \
rangechecked_cast.h \
std_utils.h \
IntegerRange.h

View file

@ -1,15 +0,0 @@
#ifndef RANGECHECKED_CAST_H
#define RANGECHECKED_CAST_H
#include <boost/assert.hpp>
#include <limits>
template <typename To, typename From>
To rangechecked_cast(From f)
{
// BOOST_ASSERT(f >= std::numeric_limits<To>::lowest());
// BOOST_ASSERT(f <= std::numeric_limits<To>::max());
return static_cast<To>(f);
}
#endif // RANGECHECKED_CAST_H