mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
static assert as discussed here https://dev.vatsim-germany.org/issues/648#note-10
#648
This commit is contained in:
committed by
Roland Winklmeier
parent
4b11eb3f83
commit
49094115b1
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "listmodeldbobjects.h"
|
||||
#include "allmodelcontainers.h"
|
||||
#include "blackmisc/datastoreobjectlist.h"
|
||||
#include <type_traits>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
@@ -21,7 +23,9 @@ namespace BlackGui
|
||||
CListModelDbObjects<ObjectType, ContainerType, KeyType, UseCompare>::CListModelDbObjects(const QString &translationContext, QObject *parent) :
|
||||
CListModelBase<ObjectType, ContainerType, UseCompare>(translationContext, parent)
|
||||
{
|
||||
// void
|
||||
constexpr bool hasIntegerKey = std::is_base_of<IDatastoreObjectWithIntegerKey, ObjectType>::value && std::is_same<int, KeyType>::value;
|
||||
constexpr bool hasStringKey = std::is_base_of<IDatastoreObjectWithStringKey, ObjectType>::value && std::is_base_of<QString, KeyType>::value;
|
||||
static_assert(hasIntegerKey || hasStringKey, "ObjectType needs to implement IDatastoreObjectWithXXXXKey and have appropriate KeyType");
|
||||
}
|
||||
|
||||
template <typename ObjectType, typename ContainerType, typename KeyType, bool UseCompare>
|
||||
|
||||
@@ -17,12 +17,17 @@
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
template <class OBJ, class CONTAINER, typename KEYTYPE>
|
||||
IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::IDatastoreObjectList()
|
||||
{ }
|
||||
{
|
||||
constexpr bool hasIntegerKey = std::is_base_of<IDatastoreObjectWithIntegerKey, OBJ>::value && std::is_same<int, KEYTYPE>::value;
|
||||
constexpr bool hasStringKey = std::is_base_of<IDatastoreObjectWithStringKey, OBJ>::value && std::is_base_of<QString, KEYTYPE>::value;
|
||||
static_assert(hasIntegerKey || hasStringKey, "ObjectType needs to implement IDatastoreObjectWithXXXXKey and have appropriate KeyType");
|
||||
}
|
||||
|
||||
template <class OBJ, class CONTAINER, typename KEYTYPE>
|
||||
OBJ IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::findByKey(KEYTYPE key, const OBJ ¬Found) const
|
||||
|
||||
@@ -12,12 +12,15 @@
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
template <class OBJ, class CONTAINER>
|
||||
IOrderableList<OBJ, CONTAINER>::IOrderableList()
|
||||
{ }
|
||||
{
|
||||
static_assert(std::is_base_of<IOrderable, OBJ>::value, "OBJ needs to implement IOrderable");
|
||||
}
|
||||
|
||||
template <class OBJ, class CONTAINER>
|
||||
const CONTAINER &IOrderableList<OBJ, CONTAINER>::container() const
|
||||
|
||||
@@ -22,12 +22,15 @@
|
||||
#include "blackmisc/countrylist.h"
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
template <class OBJ, class CONTAINER>
|
||||
ITimestampObjectList<OBJ, CONTAINER>::ITimestampObjectList()
|
||||
{ }
|
||||
{
|
||||
static_assert(std::is_base_of<ITimestampBased, OBJ>::value, "OBJ needs to implement ITimestampBased");
|
||||
}
|
||||
|
||||
template <class OBJ, class CONTAINER>
|
||||
const CONTAINER &ITimestampObjectList<OBJ, CONTAINER>::container() const
|
||||
|
||||
Reference in New Issue
Block a user