title: Is there a concept name for a regular type for which comparisons doesn't compare the full object state?
body: <p>I have a set of types which looks like this:</p>
  
  <pre><code>struct MyFlag
  {
       SomeId source_id; // INVALID_ID by default
       SomeData data; // regular type
  
       friend bool operator==( const MyFlag&amp; a, const MyFlag&amp; b ) { return a.source_id == b.source_id; }
       friend bool operator&lt;( const MyFlag&amp; a, const MyFlag&amp; b ) { return a.source_id &lt; b.source_id; }
       friend bool operator!=( const MyFlag&amp; a, const MyFlag&amp; b ) { return !(a == b); }
  
       friend bool operator==( const SomeId&amp; a, const MyFlag&amp; b ) { return a == b.source_id; }
       friend bool operator&lt;( const SomeId&amp; a, const MyFlag&amp; b ) { return a &lt; b.source_id; }
  };
  
  
  
  MyFlag flag_a { id, data_A };
  MyFlag flag_b { id, data_B };
  
  assert( flag_a == flag_b );
  assert( flag_a.data != flag_b.data );
  assert( flag_a == id );
  assert( flag_b == id ); 
  
  MyFlag flag = flag_b;
  assert( flag == flag_a );
  assert( flag == id );
  assert( flag.data != flag_a.data );
  
  const MyFlag flag_x ={ id_x, data_A };
  flag = flag_X;
  assert( flag != flag_a );
  assert( flag.data == flag_a.data );
  </code></pre>
  
  <p>That is, only a specific part of the state of the object is considered in comparison: in this example, any MyFlag object would be compared to others using their ids, but not the rest of the data they contain.</p>
  
  <p>I think it match the definition Sean Parent gave of a "value type", but I also think this is a strange or unfamiliar (but useful in my case) pattern. </p>
  
  <p>So my question is: is there a concept name for this ... concept?</p>
  
  <hr>
  
  <p>How is that kind of type useful? I use this kind of type in a "black board" event system which is basically a kind of set of any value that have a type that is at least regular.
  However, this black board systematically overwrite the value pushed (inserted) in it even if it's already found (through comparison). That way, I overwrite the full state of a value in the black board using the comparison operators as identifiers. </p>
  
  <p>I have no idea if it's a well known pattern or idea or if it's problematic on the long run. So far it have been very useful. It also feels like something that might be "too smart", but I lack experience with this pattern to confirm that. It might be that I am abusing the use of comparison operators, but it feels that the semantic of these types is correct in my use.</p>
  
  <p>I can provide a detailed example of my usage if necessary.</p>