Salut!

Ce code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <string>
#include <algorithm>
 
using namespace std;
 
int main(void){
 
    string s1="abcdef";
    string s2="abcdef";
    transform(s1.begin(),s1.end(),s1.begin(),static_cast<int(*)(int)>(toupper));
    for_each(s2.begin(),s2.end(),static_cast<int(*)(int)>(toupper));
    cout<<"s1 : "<<s1<<endl<<"s2 : "<<s2<<endl;
    system("pause");
    return EXIT_SUCCESS;
}
met bien "s1" en majuscule mais pas "s2"; pourtant "transform" et "for_each" devrait avoir un comportement similaire.
Où est l'erreur?

Merci.