Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-03-03 11:03:56 +0300
committerJacques Lucke <jacques@blender.org>2021-03-03 11:03:56 +0300
commit1cd47ba37e12f242117e1189b99e0ba98f269d33 (patch)
tree6fb16ac2bb1df63feaf7802ee4315bc52cb7032b
parent8986cb9ef8b039b207c8b8d18670b1454537f708 (diff)
operator bool
-rw-r--r--source/blender/nodes/NOD_XXX_node_tree.hh28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/nodes/NOD_XXX_node_tree.hh b/source/blender/nodes/NOD_XXX_node_tree.hh
index 0a3c6052d8a..18462c7bf8e 100644
--- a/source/blender/nodes/NOD_XXX_node_tree.hh
+++ b/source/blender/nodes/NOD_XXX_node_tree.hh
@@ -63,6 +63,8 @@ struct XXXNode {
friend bool operator==(const XXXNode &a, const XXXNode &b);
friend bool operator!=(const XXXNode &a, const XXXNode &b);
+ operator bool() const;
+
uint64_t hash() const;
};
@@ -76,6 +78,8 @@ struct XXXSocket {
friend bool operator==(const XXXSocket &a, const XXXSocket &b);
friend bool operator!=(const XXXSocket &a, const XXXSocket &b);
+ operator bool() const;
+
uint64_t hash() const;
};
@@ -88,6 +92,8 @@ struct XXXInputSocket {
friend bool operator==(const XXXInputSocket &a, const XXXInputSocket &b);
friend bool operator!=(const XXXInputSocket &a, const XXXInputSocket &b);
+ operator bool() const;
+
uint64_t hash() const;
};
@@ -100,6 +106,8 @@ struct XXXOutputSocket {
friend bool operator==(const XXXOutputSocket &a, const XXXOutputSocket &b);
friend bool operator!=(const XXXOutputSocket &a, const XXXOutputSocket &b);
+ operator bool() const;
+
uint64_t hash() const;
};
@@ -168,6 +176,11 @@ inline bool operator!=(const XXXNode &a, const XXXNode &b)
return !(a == b);
}
+inline XXXNode::operator bool() const
+{
+ return node != nullptr;
+}
+
inline uint64_t XXXNode::hash() const
{
return DefaultHash<XXXNodeTreeContext>{}(context) ^ DefaultHash<const NodeRef *>{}(node);
@@ -197,6 +210,11 @@ inline bool operator!=(const XXXSocket &a, const XXXSocket &b)
return !(a == b);
}
+inline XXXSocket::operator bool() const
+{
+ return socket != nullptr;
+}
+
inline uint64_t XXXSocket::hash() const
{
return DefaultHash<XXXNodeTreeContext>{}(context) ^ DefaultHash<const SocketRef *>{}(socket);
@@ -221,6 +239,11 @@ inline bool operator!=(const XXXInputSocket &a, const XXXInputSocket &b)
return !(a == b);
}
+inline XXXInputSocket::operator bool() const
+{
+ return socket != nullptr;
+}
+
inline uint64_t XXXInputSocket::hash() const
{
return DefaultHash<XXXNodeTreeContext>{}(context) ^
@@ -246,6 +269,11 @@ inline bool operator!=(const XXXOutputSocket &a, const XXXOutputSocket &b)
return !(a == b);
}
+inline XXXOutputSocket::operator bool() const
+{
+ return socket != nullptr;
+}
+
inline uint64_t XXXOutputSocket::hash() const
{
return DefaultHash<XXXNodeTreeContext>{}(context) ^