当前位置: 首页>>代码示例>>C++>>正文


C++ Tuple::delete_inplace方法代码示例

本文整理汇总了C++中Tuple::delete_inplace方法的典型用法代码示例。如果您正苦于以下问题:C++ Tuple::delete_inplace方法的具体用法?C++ Tuple::delete_inplace怎么用?C++ Tuple::delete_inplace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tuple的用法示例。


在下文中一共展示了Tuple::delete_inplace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test_delete_inplace

  void test_delete_inplace() {
    Tuple *tuple = new_tuple();

    tuple->put(state, 1, Qnil);
    Integer *count = tuple->delete_inplace(state, Fixnum::from(0), Fixnum::from(3), Qnil);

    TS_ASSERT_EQUALS(1, count->to_native());
    TS_ASSERT_EQUALS(Fixnum::from(1), as<Fixnum>(tuple->at(state, 0)));
    TS_ASSERT_EQUALS(Fixnum::from(9), as<Fixnum>(tuple->at(state, 1)));
    TS_ASSERT_EQUALS(Qnil, tuple->at(state, 2));
  }
开发者ID:AndreMeira,项目名称:rubinius,代码行数:11,代码来源:test_tuple.hpp

示例2: test_delete_inplace_bounds

  void test_delete_inplace_bounds() {
    Tuple *tuple = new_tuple();

    Integer *count;
    TS_ASSERT_THROWS_ASSERT(count = tuple->delete_inplace(state, Fixnum::from(0), Fixnum::from(4), Qnil),
			    const RubyException &e,
			    TS_ASSERT(Exception::object_bounds_exceeded_error_p(state, e.exception)));
    TS_ASSERT_THROWS_ASSERT(count = tuple->delete_inplace(state, Fixnum::from(1), Fixnum::from(3), Qnil),
			    const RubyException &e,
			    TS_ASSERT(Exception::object_bounds_exceeded_error_p(state, e.exception)));
    TS_ASSERT_THROWS_ASSERT(count = tuple->delete_inplace(state, Fixnum::from(-1), Fixnum::from(3), Qnil),
			    const RubyException &e,
			    TS_ASSERT(Exception::object_bounds_exceeded_error_p(state, e.exception)));
    TS_ASSERT_THROWS_ASSERT(count = tuple->delete_inplace(state, Fixnum::from(0), Fixnum::from(-1), Qnil),
			    const RubyException &e,
			    TS_ASSERT(Exception::object_bounds_exceeded_error_p(state, e.exception)));
    TS_ASSERT_THROWS_ASSERT(count = tuple->delete_inplace(state, Fixnum::from(3), Fixnum::from(1), Qnil),
			    const RubyException &e,
			    TS_ASSERT(Exception::object_bounds_exceeded_error_p(state, e.exception)));
  }
开发者ID:AndreMeira,项目名称:rubinius,代码行数:20,代码来源:test_tuple.hpp

示例3:

  void Module::Info::mark(Object* obj, ObjectMark& mark) {
    auto_mark(obj, mark);

    Array* subclasses = as<Module>(obj)->hierarchy_subclasses_;
    if(subclasses->nil_p()) return;

    native_int offset = subclasses->offset();
    native_int size = subclasses->size();
    Tuple* tup = subclasses->tuple();

    for(native_int i = offset; i < size + offset; ++i) {
      if(WeakRef* ref = try_as<WeakRef>(tup->field[i])) {
        if(!ref->alive_p()) {
          tup->field[i] = cNil;
        }
      }
    }
    subclasses->set_size(size - tup->delete_inplace(offset, size, cNil));
  }
开发者ID:,项目名称:,代码行数:19,代码来源:


注:本文中的Tuple::delete_inplace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。