#include "stdafx.h"
#include <vector>
#include <algorithm>
#include <iostream>
#include <locale>
#include <functional>
using namespace std;

class Widget
{
public:
	Widget(wstring str)
	{
		str_ = str;
	}
	wstring str_;

	void Print()
	{
		wcout<<str_<<endl;
	}
};

void test(Widget &w)
{
	wcout<<w.str_<<endl;
}

int main()
{
	locale loc( "chs" );
	wcout.imbue( loc );
	
	vector<Widget*> w_list;
	Widget w(_T("小的"));
	w_list.push_back(&w);

	Widget w1(_T("大的"));
	w_list.push_back(&w1);


	for_each(w_list.begin(),w_list.end(),mem_fun(&Widget::Print));
	

}

相关文章:

  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2022-02-14
  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2021-08-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-27
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2021-09-30
相关资源
相似解决方案