[commit] r2730 - in trunk/GME: Common Core

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed Jan 24 11:07:16 CST 2018


Author: ksmyth
Date: Wed Jan 24 11:07:16 2018
New Revision: 2730

Log:
Use container.size() instead of iterating through the whole thing

Modified:
   trunk/GME/Common/CommonStl.h
   trunk/GME/Core/CoreAttribute.h

Modified: trunk/GME/Common/CommonStl.h
==============================================================================
--- trunk/GME/Common/CommonStl.h	Thu Dec 14 16:10:44 2017	(r2729)
+++ trunk/GME/Common/CommonStl.h	Wed Jan 24 11:07:16 2018	(r2730)
@@ -4,6 +4,7 @@
 
 #include <vector>
 #include <string>
+#include <algorithm>
 
 #ifndef MGA_COMMONSMART_H
 #include "CommonSmart.h"
@@ -186,6 +187,14 @@
 template<class CONTAINER>
 inline int limited_size(const CONTAINER &container, int limit)
 {
+	ASSERT(limit >= 1);
+
+	return (std::min)(static_cast<CONTAINER::size_type>(limit), container.size());
+}
+
+template<class CONTAINER>
+inline int limited_size_count(const CONTAINER &container, int limit)
+{
 	ASSERT( limit >= 1 );
 	int counter = limit;
 

Modified: trunk/GME/Core/CoreAttribute.h
==============================================================================
--- trunk/GME/Core/CoreAttribute.h	Thu Dec 14 16:10:44 2017	(r2729)
+++ trunk/GME/Core/CoreAttribute.h	Wed Jan 24 11:07:16 2018	(r2730)
@@ -478,7 +478,7 @@
 #endif
 
 public:
-	typedef std::set< CCoreObject*, ptr_compare<CCoreObject> > objects_type;
+	typedef CCorePointerAttrBase::objects_type objects_type;
 	typedef objects_type::iterator objects_iterator;
 
 public:


More information about the gme-commit mailing list