1,使用+=操作符

#include <iostream> 
using namespace std;

#include <boost/thread.hpp>
#include <boost/assign.hpp>
using namespace boost;
using namespace boost::assign;


int main(int argc, _TCHAR* argv[])
{
	
	vector<int> v;
	v += 1,2,3,4,5,6*6;

	set<string> s;
	s += "cpp","java","c#","python";

	map<int,string> m;
	m += make_pair(1,"one"),make_pair(2,"two");

	return 0;
}

 

2.使用()操作符

#include <iostream> 
using namespace std;

#include <boost/thread.hpp>
#include <boost/assign.hpp>
using namespace boost;
using namespace boost::assign;


int main(int argc, _TCHAR* argv[])
{
	
	vector<int> v;
	push_back(v)(1)(2)(3)(4)(5);

	list<string> l;
	push_front(l)("cpp")("java")("c#")("python");

	set<double> s;
	insert(s)(3.14)(0.618)(1.732);
	
	map<int,string> m;
	insert(m)(1,"one")(2,"two");

	return 0;
}

相关文章:

  • 2021-10-07
  • 2021-12-16
  • 2021-06-25
  • 2021-10-20
  • 2021-07-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-28
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2021-06-17
  • 2021-10-25
相关资源
相似解决方案