Improve loops & fix cpp check warning

- This commit improves certain while loops to range based for loops.

- This commit also fixes the cppcheck warning that mentions about
  performance issues when using postfix operators on non-primitive
  types.

Tested By:
- A function is unittested.
- GET on both EthernetInterfaces & certificate service
  looks good without any issues.

Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: I85420f7bf9af45a97e1a93b916f292c2516f5802
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 55f1cf5..48b69a2 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -1375,34 +1375,26 @@
 
     boost::container::flat_set<IPv4AddressData>::const_iterator
         getNextStaticIpEntry(
-            boost::container::flat_set<IPv4AddressData>::const_iterator head,
+            const boost::container::flat_set<IPv4AddressData>::const_iterator&
+                head,
             const boost::container::flat_set<IPv4AddressData>::const_iterator&
                 end)
     {
-        for (; head != end; head++)
-        {
-            if (head->origin == "Static")
-            {
-                return head;
-            }
-        }
-        return end;
+        return std::find_if(head, end, [](const IPv4AddressData& value) {
+            return value.origin == "Static";
+        });
     }
 
     boost::container::flat_set<IPv6AddressData>::const_iterator
         getNextStaticIpEntry(
-            boost::container::flat_set<IPv6AddressData>::const_iterator head,
+            const boost::container::flat_set<IPv6AddressData>::const_iterator&
+                head,
             const boost::container::flat_set<IPv6AddressData>::const_iterator&
                 end)
     {
-        for (; head != end; head++)
-        {
-            if (head->origin == "Static")
-            {
-                return head;
-            }
-        }
-        return end;
+        return std::find_if(head, end, [](const IPv6AddressData& value) {
+            return value.origin == "Static";
+        });
     }
 
     void handleIPv4StaticPatch(