Skip to content

Yaml configuration with map of maps #20

@MeanSquaredError

Description

@MeanSquaredError

It seems that figcone has trouble handling a map of maps, e.g the following config structure

struct config_struct
{
	using auth_map = std::unordered_map<std::string, std::string>;
	using servers_map = std::unordered_map<std::string, auth_map>;
	servers_map servers;
};

Generates the following error:

In file included from /usr/local/projects/private/myproj/source/config/config_reader.cpp:5:
/usr/local/include/figcone/configreader.h: In instantiation of ‘void figcone::ConfigReader::loadField(TCfg&, TField&, std::string_view) [with TCfg = config_struct; TField = std::unordered_map<std::__cxx11::basic_string<char>, std::unordered_map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >; std::string_view = std::basic_string_view<char>]’:
/usr/local/include/figcone/configreader.h:394:19:   required from ‘void figcone::ConfigReader::loadStructure(TCfg&, std::index_sequence<Ints ...>) [with TCfg = config_struct; long unsigned int ...indices = {0, 1, 2, 3}; std::index_sequence<Ints ...> = std::integer_sequence<long unsigned int, 0, 1, 2, 3>]’
/usr/local/include/figcone/configreader.h:406:22:   required from ‘void figcone::ConfigReader::loadStructure(TCfg&) [with TCfg = config_struct]’
/usr/local/include/figcone/configreader.h:422:26:   required from ‘TCfg figcone::ConfigReader::readConfig(const figcone::TreeNode&) [with TCfg = config_struct]’
/usr/local/include/figcone/configreader.h:311:53:   required from ‘std::conditional_t<(rootType == figcone::RootType::SingleNode), TCfg, std::vector<TCfg> > figcone::ConfigReader::read(std::istream&, figcone::IParser&) [with TCfg = config_struct; figcone::RootType rootType = figcone::RootType::SingleNode; std::conditional_t<(rootType == figcone::RootType::SingleNode), TCfg, std::vector<TCfg> > = config_struct; std::istream = std::basic_istream<char>]’
/usr/local/include/figcone/configreader.h:90:36:   required from ‘std::conditional_t<(rootType == figcone::RootType::SingleNode), TCfg, std::vector<TCfg> > figcone::ConfigReader::readFile(const std::filesystem::__cxx11::path&, figcone::IParser&) [with TCfg = config_struct; figcone::RootType rootType = figcone::RootType::SingleNode; std::conditional_t<(rootType == figcone::RootType::SingleNode), TCfg, std::vector<TCfg> > = config_struct]’
/usr/local/include/figcone/configreader.h:134:40:   required from ‘std::conditional_t<(rootType == figcone::RootType::SingleNode), TCfg, std::vector<TCfg> > figcone::ConfigReader::readYamlFile(const std::filesystem::__cxx11::path&) [with TCfg = config_struct; figcone::RootType rootType = figcone::RootType::SingleNode; std::conditional_t<(rootType == figcone::RootType::SingleNode), TCfg, std::vector<TCfg> > = config_struct]’
/usr/local/projects/private/myproj/source/config/config_reader.cpp:10:53:   required from here
/usr/local/include/figcone/configreader.h:357:100: error: static assertion failed: Dict value type must be readable from stringtream or registered with StringConverter
  357 |                     detail::canBeReadAsParam<typename sfun::remove_optional_t<TField>::mapped_type>(),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/usr/local/include/figcone/configreader.h:357:100: note: ‘figcone::detail::canBeReadAsParam<std::unordered_map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >()’ evaluates to false

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions