Skip to content

added explicit cast to underlying type of attributes

Summary

Replaces an implicit cast to char with an explicit cast.

Details

In RemoteIndex the Attribute type (typically something like an enum) is stored in a char (for whatever reason). In case the attribute type is an enum class instead of an old-style enum, the implicit cast to 'char' does not work. The workaround is to explicitly cast to the underlying integer type first and then pass this value to the member variable.

Discussion

An alternative fix would be to change the type of the member variable attribute_ to the actual attribute type.

--- a/dune/common/parallel/remoteindices.hh
+++ b/dune/common/parallel/remoteindices.hh
@@ -145,7 +145,7 @@ namespace Dune {
     const PairType* localIndex_;
 
     /** @brief The attribute of the index on the other process. */
-    char attribute_;
+    Attribute attribute_;
   };
 
   template<class T, class A>

This would maybe change the size of the RemoteIndex type and would thus result in larger communication costs.

Edited by Simon Praetorius

Merge request reports