c++ - Multiply vector elements by a scalar value using STL -


hi want (multiply,add,etc) vector scalar value example myv1 * 3 , know can function forloop , there way of doing using stl function? {algorithm.h :: transform function }?

yes, using std::transform:

std::transform(myv1.begin(), myv1.end(), myv1.begin(),                std::bind1st(std::multiplies<t>(),3)); 

Comments

Popular posts from this blog

drupal - using views argument in the view tpl.php file -

php - Posting PHPBB Forum Thread/Post info in a website -

silverlight - Applying a style to ItemContainerStyle in C# -