Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library usage #148

Open
cgurps opened this issue May 18, 2020 · 2 comments
Open

Library usage #148

cgurps opened this issue May 18, 2020 · 2 comments

Comments

@cgurps
Copy link

cgurps commented May 18, 2020

Good morning,

this is not an issue but more a question about the library usage. Let's say I have a struct like this:

struct A
{
    //some data
    char* data;

    // and integer used for ordering
    uint32_t size;

    bool operator>(const A& other) const
    {
        return size > other.size;
    }
};

I'm using the LazyList as a container for that struct. The ordering for that list is std::greater<A> (which uses the operator> of the list). Is is possible to use a function that returns an element of the list that is inferior or equal to some input node (like upper_bound does in the standard library)?

In other word, is there a container in libcds that can achieve that?

@khizmax
Copy link
Owner

khizmax commented May 18, 2020

Hi,
no, libcds containers don't provide functions like upper_bound/lower_bound, only exact match is supported. In concurrent environment these functions don't make sense. For example, I found upper bound for some key but other concurrent thread inserts another key that match better for upper bound.

@cgurps
Copy link
Author

cgurps commented May 18, 2020

Thanks for clarification! In my case I don't really care about the best match, I just need one but your comments makes sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants