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

Can't use realtime object in class templates #8

Closed
salsa-sound opened this issue Jun 2, 2021 · 2 comments
Closed

Can't use realtime object in class templates #8

salsa-sound opened this issue Jun 2, 2021 · 2 comments

Comments

@salsa-sound
Copy link

From what I can see realtime object does not work with class templates. This does not compile:

template<typename FloatType>
class Test
{
public:
    Test()
    {
        farbot::RealtimeObject<std::vector<FloatType>, farbot::RealtimeObjectOptions::nonRealtimeMutatable> obj;
        farbot::RealtimeObject<std::vector<FloatType>, farbot::RealtimeObjectOptions::nonRealtimeMutatable>::ScopedAccess<farbot::ThreadType::nonRealtime> t(obj);
        
        t->push_back(6.0);
    }
};

Why is this?

@anbjoernskov
Copy link

anbjoernskov commented Sep 14, 2021

Check out this other issue, which describes how to use 'typename' and 'template' keywords. So in your case it should be

typename farbot::RealtimeObject<std::vector<FloatType>, farbot::RealtimeObjectOptions::nonRealtimeMutatable>::template ScopedAccess<farbot::ThreadType::nonRealtime> t(obj);

#2 (comment)

@salsa-sound
Copy link
Author

Thanks!

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