Example #1
0
void
__libcpp_db::__iterator_copy(void* __i, const void* __i0)
{
    WLock _(mut());
    __i_node* i = __find_iterator(__i);
    __i_node* i0 = __find_iterator(__i0);
    __c_node* c0 = i0 != nullptr ? i0->__c_ : nullptr;
    if (i == nullptr && c0 != nullptr)
        i = __insert_iterator(__i);
    __c_node* c = i != nullptr ? i->__c_ : nullptr;
    if (c != c0)
    {
        if (c != nullptr)
            c->__remove(i);
        if (i != nullptr)
        {
            i->__c_ = nullptr;
            if (c0 != nullptr)
            {
                i->__c_ = c0;
                i->__c_->__add(i);
            }
        }
    }
}
Example #2
0
void
__libcpp_db::__insert_i(void* __i)
{
#ifndef _LIBCPP_HAS_NO_THREADS
    WLock _(mut());
#endif
    __insert_iterator(__i);
}
Example #3
0
void
__libcpp_db::__insert_ic(void* __i, const void* __c)
{
    WLock _(mut());
    if (__cbeg_ == __cend_)
        return;
    size_t hc = hash<const void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
    __c_node* c = __cbeg_[hc];
    if (c == nullptr)
        return;
    while (c->__c_ != __c)
    {
        c = c->__next_;
        if (c == nullptr)
            return;
    }
    __i_node* i = __insert_iterator(__i);
    c->__add(i);
    i->__c_ = c;
}
Example #4
0
void
__libcpp_db::__insert_ic(void* __i, const void* __c)
{
    WLock _(mut());
    __i_node* i = __insert_iterator(__i);
    const char* errmsg =
        "Container constructed in a translation unit with debug mode disabled."
        " But it is being used in a translation unit with debug mode enabled."
        " Enable it in the other translation unit with #define _LIBCPP_DEBUG2 1";
    _LIBCPP_ASSERT(__cbeg_ != __cend_, errmsg);
    size_t hc = hash<const void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
    __c_node* c = __cbeg_[hc];
    _LIBCPP_ASSERT(c != nullptr, errmsg);
    while (c->__c_ != __c)
    {
        c = c->__next_;
        _LIBCPP_ASSERT(c != nullptr, errmsg);
    }
    c->__add(i);
    i->__c_ = c;
}
Example #5
0
void
__libcpp_db::__insert_i(void* __i)
{
    WLock _(mut());
    __insert_iterator(__i);
}