Beispiel #1
0
void task4_5::solution::search_max(const vect &subVect)
{
	if(!subVect.empty())
	{
		int locMax = subVect.at(0);

		for( vect::const_iterator it = subVect.begin() + 1; it != subVect.end(); ++it)
			if(*it > locMax) locMax = *it;

		boost::mutex::scoped_lock lock(mutex);
		{
			if(locMax > max) max = locMax;
		}
	}
}
Beispiel #2
0
void task4_5::solution::search_min(const vect &subVect)
{
	if(!subVect.empty())
	{
		int locMin = subVect.at(0);

		for( vect::const_iterator it = subVect.begin() + 1; it != subVect.end(); ++it)
			if(*it < locMin) locMin = *it;

		boost::mutex::scoped_lock lock(mutex);
		{
			if(locMin < min) min = locMin;
		}
	}
}