diff options
Diffstat (limited to 'src/MuxElements.cpp')
-rw-r--r-- | src/MuxElements.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp index 0a52f0b..4bd82cd 100644 --- a/src/MuxElements.cpp +++ b/src/MuxElements.cpp @@ -191,19 +191,19 @@ vector<DabComponent*>::iterator getComponent( return getComponent(components, serviceId, components.end()); } -vector<DabService*>::iterator getService( +std::vector<std::shared_ptr<DabService> >::iterator getService( DabComponent* component, - vector<DabService*>& services) + std::vector<std::shared_ptr<DabService> >& services) { - vector<DabService*>::iterator service; - - for (service = services.begin(); service != services.end(); ++service) { - if ((*service)->id == component->serviceId) { - break; + size_t i = 0; + for (auto service : services) { + if (service->id == component->serviceId) { + return services.begin() + i; } + i++; } - return service; + throw std::runtime_error("Service not included in any component"); } bool DabComponent::isPacketComponent(vector<dabSubchannel*>& subchannels) |