ワイド文字列(wstring, wchar_t)を環境のエンコードにおける順序でソートする

#include <locale>
#include <string>
#include <algorithm>
#include <iostream>
#include <iterator>

int main()
{
  using namespace std;

  locale::global(locale(""));

  wstring str[] = {L"亜", L"井", L"宇", L"江", L"尾"};

  sort(str, str + 5);

  cout << "Unicode(UCS)でのソート結果" << endl;
  copy(str, str + 5,
    ostream_iterator<wstring, wchar_t>(wcout, L"\n"));

  sort(str, str + 5, locale(""));

  cout << endl;
  cout
    << "Shift_JIS(Windos環境下)もしくはEUC-JP(UNIX環境下)でのソート結果"
    << endl;
  copy(str, str + 5,
    ostream_iterator<wstring, wchar_t>(wcout, L"\n"));
}

うふ.うふふ.うふふふふ.