Changeset 145:ae5a7c09b179 in rrlib_rtti


Ignore:
Timestamp:
20.05.2020 11:05:04 (2 weeks ago)
Author:
Max Reichardt <max.reichardt@…>
Branch:
17.03
Phase:
public
Tags:
tip
Message:

Adds check for inconsistent compile time info of registered types (which can lead to duplicate entries)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • detail/tTypeInfo.cpp

    r134 r145  
    649649  std::unique_lock<std::recursive_mutex> lock(internal_data.mutex); 
    650650 
     651  // Check for invalid entries (debug mode only, as complexity doing this for all added types is O(n)) 
     652#ifndef NDEBUG 
     653  for (auto it = internal_data.types.Begin(); it != internal_data.types.End() && type_info; ++it) 
     654  { 
     655    if (it->info->std_type_info == type_info->std_type_info) 
     656    { 
     657      RRLIB_LOG_PRINT(ERROR, "Inconsistent compile-time type info detected for type ", *it, " (", type_info->std_type_info.name(), "). If e.g. serialization operators are defined, please ensure that they are always included when using this type with rrlib_rtti."); 
     658    } 
     659  } 
     660#endif 
     661 
    651662  handle = static_cast<short>(internal_data.types.Size()); 
    652663  internal_data.types.Add(tType(type_info)); 
Note: See TracChangeset for help on using the changeset viewer.