Ejemplo n.º 1
0
void insert(container& c, int key, int val)
{
	auto itr = c.insert(make_pair(key,val));
	if(!itr.second)
	{
		cout << "re-insert " << "[" << key << "," << val << "]" << "!!!" << endl;
#if 0
		c.erase(itr.first);
		c.insert(make_pair(key,val));
#else
		itr.first->second = val;
#endif
	}
}
Ejemplo n.º 2
0
  void
  multimap_algorithms<ContainerTraits, Ovr>::insert(
      container &c, index_param ix, value_param val)
  {
    typedef std::pair
      <BOOST_DEDUCED_TYPENAME self_type::container_traits::index_type,
      BOOST_DEDUCED_TYPENAME self_type::container_traits::value_type>
      pair_type;

    // Can't use std::make_pair, because param types may be references
    c.insert (pair_type (ix, val) );
  }
Ejemplo n.º 3
0
  void
  set_algorithms<ContainerTraits, Ovr>::insert(
      container &c, index_param ix)
  {
    c.insert (ix);
    //~ Python set does not raise exception in this situation
    //~ if (!c.insert (ix).second)
      //~ {
        //~ PyErr_SetString(
            //~ PyExc_ValueError, "Set already holds value for insertion");

        //~ boost::python::throw_error_already_set ();
      //~ }
  }
Ejemplo n.º 4
0
  void
  map_algorithms<ContainerTraits, Ovr>::insert(
      container &c, index_param ix, value_param val)
  {
    typedef std::pair
      <BOOST_DEDUCED_TYPENAME self_type::container_traits::index_type,
      BOOST_DEDUCED_TYPENAME self_type::container_traits::value_type>
      pair_type;

    // Can't use std::make_pair, because param types may be references

    if (!c.insert (pair_type (ix, val)).second)
      {
        PyErr_SetString(
            PyExc_ValueError, "Map already holds value for insertion");

        boost::python::throw_error_already_set ();
      }
  }
Ejemplo n.º 5
0
 arguments(std::initializer_list<value_type> x) { insert(x); }