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


C++ PackedVector::set方法代码示例

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


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

示例1: append_front

inline void PackedDeque::append_front(const uint64_t& value) {
    if (filled == vec.size()) {
        size_t new_capacity = size_t(factor * vec.size()) + 1;
        PackedVector new_vec;
        new_vec.resize(new_capacity);
        
        new_vec.set(0, value);
        for (size_t i = 0; i < filled; i++) {
            new_vec.set(i + 1, get(i));
        }
        
        vec = std::move(new_vec);
        begin_idx = 0;
    }
    else {
        if (begin_idx == 0) {
            begin_idx = vec.size() - 1;
        }
        else {
            begin_idx--;
        }
        vec.set(begin_idx, value);
    }
    
    filled++;
}
开发者ID:glennhickey,项目名称:vg,代码行数:26,代码来源:packed_structs.hpp

示例2: set

inline void PagedVector::set(const size_t& i, const uint64_t& value) {
    assert(i < filled);
    uint64_t anchor = anchors.get(i / page_size);
    if (anchor == 0) {
        // this page does not have a non-zero anchor yet, use this one
        anchors.set(i / page_size, value);
        anchor = value;
    }
    pages[i / page_size].set(i % page_size, to_diff(value, anchor));
}
开发者ID:glennhickey,项目名称:vg,代码行数:10,代码来源:packed_structs.hpp

示例3: append_back

inline void PackedDeque::append_back(const uint64_t& value) {
    // expand capacity if necessary
    if (filled == vec.size()) {
        size_t new_capacity = size_t(factor * vec.size()) + 1;
        reserve(new_capacity);
    }
    
    // update the pointer to the back
    filled++;
    
    // set the value
    vec.set(internal_index(filled - 1), value);
}
开发者ID:vgteam,项目名称:vg,代码行数:13,代码来源:packed_structs.hpp

示例4: append_back

inline void PackedDeque::append_back(const uint64_t& value) {
    if (filled == vec.size()) {
        size_t new_capacity = size_t(factor * vec.size()) + 1;
        PackedVector new_vec;
        new_vec.resize(new_capacity);
        
        for (size_t i = 0; i < filled; i++) {
            new_vec.set(i, get(i));
        }
        new_vec.set(filled, value);
        
        vec = std::move(new_vec);
        begin_idx = 0;
        filled++;
    }
    else {
        filled++;
        vec.set(internal_index(filled - 1), value);
    }
}
开发者ID:glennhickey,项目名称:vg,代码行数:20,代码来源:packed_structs.hpp

示例5: append_front

inline void PackedDeque::append_front(const uint64_t& value) {
    // expand capacity if necessary
    if (filled == vec.size()) {
        size_t new_capacity = size_t(factor * vec.size()) + 1;
        reserve(new_capacity);
    }
    
    // update the pointer to the front
    if (begin_idx == 0) {
        begin_idx = vec.size() - 1;
    }
    else {
        begin_idx--;
    }
    // update the pointer to the back
    filled++;
    
    // set the value
    vec.set(internal_index(0), value);
}
开发者ID:vgteam,项目名称:vg,代码行数:20,代码来源:packed_structs.hpp

示例6: set_parent

inline void PackedSplayTree::set_parent(size_t x, size_t y) {
    tree.set((x - 1) * NODE_SIZE + PARENT_OFFSET, y);
}
开发者ID:glennhickey,项目名称:vg,代码行数:3,代码来源:packed_structs.hpp

示例7: set_right

inline void PackedSplayTree::set_right(size_t x, size_t y) {
    tree.set((x - 1) * NODE_SIZE + RIGHT_CHILD_OFFSET, y);
}
开发者ID:glennhickey,项目名称:vg,代码行数:3,代码来源:packed_structs.hpp

示例8: set_left

inline void PackedSplayTree::set_left(size_t x, size_t y) {
    tree.set((x - 1) * NODE_SIZE + LEFT_CHILD_OFFSET, y);
}
开发者ID:glennhickey,项目名称:vg,代码行数:3,代码来源:packed_structs.hpp

示例9: set_value

inline void PackedSplayTree::set_value(size_t x, size_t val) {
    tree.set((x - 1) * NODE_SIZE + VALUE_OFFSET, val);
}
开发者ID:glennhickey,项目名称:vg,代码行数:3,代码来源:packed_structs.hpp

示例10: set_key

inline void PackedSplayTree::set_key(size_t x, size_t val) {
    tree.set((x - 1) * NODE_SIZE + KEY_OFFSET, val);
}
开发者ID:glennhickey,项目名称:vg,代码行数:3,代码来源:packed_structs.hpp


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