Basic question on iterators of vecotor of objects...

Basic question on iterators of vecotor of objects...

Postby wynand494 » Mon Aug 04, 2008 3:20 am

Hi Cuch,



I have the following error message while using an iterator on a vector of objects. Not sure what I am doing wrong...



Code: Select all



/*****************************************************************************/

Date goodDay

   (

   const Date& StartDate,

   const std::vector<dat2008::Date>& Holidays,

   const RollConvention& Convention

   )

/*****************************************************************************/

{   

   Date Temp(StartDate.serial());



   if (Temp.weekday() == 1) Temp.serial(Temp.serial() + 1);

   if (Temp.weekday() == 7) Temp.serial(Temp.serial() + 2);



   std::vector<Date>::iterator hols_iter;





for (hols_iter = Holidays.begin();hols_iter!= Holidays.end();++hols_iter)

{

   if (Temp.serial() == hols_iter->serial())

   {

      Temp.serial(Temp.serial()+1);

      break;

   }

}



   return Temp;

}







error message



Error 1 error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::_Vector_const_iterator<_Ty,_Alloc>' (or there is no acceptable conversion)



Date is my date class which is like below



/*

________________________________________

DATE // Class Name

________________________________________



VDMY: vector<double>[4] // Attributes

________________________________________



serial():double // Operations

serial(double)

day():double

month():double

year():double

________________________________________





*/



Code: Select all
wynand494
 
Posts: 3
Joined: Tue Jul 08, 2008 3:38 pm

Postby Cuchulainn » Sat Aug 09, 2008 6:56 pm

Hi Wynd

I see that this problem was solved by Athletico now. Correct?
User avatar
Cuchulainn
 
Posts: 677
Joined: Mon Dec 18, 2006 2:48 pm
Location: Amsterdam, the Netherlands

Postby wynand494 » Sun Aug 10, 2008 1:33 am

yes. schoolboy error :) thanks
wynand494
 
Posts: 3
Joined: Tue Jul 08, 2008 3:38 pm


Return to C++

Who is online

Users browsing this forum: No registered users and 2 guests

cron