summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-09-24 16:11:21 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-09-24 16:11:21 +0100
commitdebf630ad52968a59871da0e1ba6ee2a8b16deaf (patch)
tree8292d8bb8098103d35235b914dc5a949b82f4d63
parentSingle thrower of AbstractClassException (diff)
downloadslicer-debf630ad52968a59871da0e1ba6ee2a8b16deaf.tar.bz2
slicer-debf630ad52968a59871da0e1ba6ee2a8b16deaf.tar.xz
slicer-debf630ad52968a59871da0e1ba6ee2a8b16deaf.zip
Add traits for optionals
-rw-r--r--slicer/slicer/modelPartsTypes.cpp4
-rw-r--r--slicer/slicer/modelPartsTypes.h12
2 files changed, 16 insertions, 0 deletions
diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp
index e65d721..0fa502b 100644
--- a/slicer/slicer/modelPartsTypes.cpp
+++ b/slicer/slicer/modelPartsTypes.cpp
@@ -27,6 +27,10 @@ namespace Ice {
}
namespace Slicer {
+ static_assert(!isOptional<int>::value);
+ static_assert(isOptional<::Ice::optional<int>>::value);
+ static_assert(isOptional<::IceUtil::Optional<int>>::value);
+
using ClassRefMap = std::map<std::string, const ClassRefBase *, std::less<>>;
using ClassNamePair = std::pair<std::string_view, std::string>;
using ClassNameMap = boost::multi_index_container<ClassNamePair,
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index e73b99c..93339db 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -21,6 +21,18 @@ namespace Slicer {
static constexpr bool value = false;
};
+ template<typename T> struct isLocal<::Ice::optional<T>> {
+ static constexpr bool value = isLocal<T>::value;
+ };
+
+ template<typename T> struct isOptional {
+ static constexpr bool value = false;
+ };
+
+ template<typename T> struct isOptional<::Ice::optional<T>> {
+ static constexpr bool value = true;
+ };
+
DLL_PUBLIC bool optionalCaseEq(std::string_view a, std::string_view b, bool matchCase);
template<typename T> class ModelPartForRoot : public ModelPartForRootBase {