Skip to content

How to get and set strings from and to a store? #72

@RobertoRoos

Description

@RobertoRoos

I have a store like this:

{
    uint8=0 id
    string:32 name
}[5] boards

How are you supposed to get/set the string fields?

E.g. this...

const auto &store = Logging::Logger::GetNameStore();
const std::string realName = store.boards_0__name;

Failed to compile with the error:

error: conversion from ‘const stored::impl::StoreVariantV<stored::IDNameStoreBaseLogging::IDNameStore, Logging::IDNameStore, stored::Type::String, 2200, 32>’ to non-scalar type ‘const std::string’ {aka ‘const std::__cxx11::basic_string’} requested

Similarly on

const std:;string name = "hello";
m_nameStore.boards_0__name = name;

I get the error

error: no match for ‘operator=’ (operand types are ‘stored::impl::StoreVariantV<stored::IDNameStoreBaseLogging::IDNameStore, Logging::IDNameStore, stored::Type::String, 2000, 32>’ and ‘const std::string’ {aka ‘const std::__cxx11::basic_string’})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions