<div>I&#39;m not sure if I&#39;m blind or if something like this doesn&#39;t exist. How can I check whether two types are compatible?</div><div><br></div><div>Here&#39;s the scenario:</div><div><br></div><div>I&#39;m implementing communication primitives for a parallel bipartite graph and want to be able to move composite types such as user-defined structs associated with each vertex in the graph. I call this the &quot;unit&quot; type.</div>
<div><br></div><div>Inside my communication library, I&#39;m constructing composite datatypes for each unit that needs to be sent. I&#39;d like to create these lazily (the first time the user tries to use that unit) and cache them for future use. I MPI_Type_dup() the unit so that lifetime of the custom type can be managed independently (shorter or longer) from lifetime of the communication graph object.</div>
<div><br></div><div>Now I need to determine whether a user-provided &quot;unit&quot; is already cached. I don&#39;t mind a linear search, but I don&#39;t have an &quot;equality&quot; test. I can call MPI_Type_get_envelope() and MPI_Type_get_contents(), but I would have to explore this backward for types that have been duped and it just doesn&#39;t seem like a robust equality test. Is there such a thing?</div>
<div><br></div><div>Do you have a different recommendation?</div>