MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ sort_by_attribute()

void MayaFlux::Kakshya::RegionGroup::sort_by_attribute ( const std::string &  attr_name)
inline

Sort regions by a specific attribute (numeric).

Parameters
attr_nameThe attribute name.

Definition at line 149 of file RegionGroup.hpp.

150 {
151 std::ranges::sort(regions,
152 [&attr_name](const Region& a, const Region& b) {
153 auto a_val = a.get_attribute<double>(attr_name);
154 auto b_val = b.get_attribute<double>(attr_name);
155 if (a_val && b_val)
156 return *a_val < *b_val;
157 return false;
158 });
159 }
std::vector< Region > regions
Collection of regions belonging to this group.

References MayaFlux::Kakshya::Region::get_attribute().

+ Here is the call graph for this function: