skystrife / cpptoml

cpptoml is a header-only library for parsing TOML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error: base operand of ‘->’ has non-pointer type ‘cpptoml::table’

Michael-Liao opened this issue · comments

Description

I was following the usage notes in the README but I just couldn't get the value.
Here's my code:
in main.cpp

int main(int argc, char const *argv[]) {

  cpptoml::table t = cpptoml::parse_file("config.toml");
  cpptoml::option<float> rainrate = t->get_qualified_as<float>("rainRate");
  cout<< rainrate <<endl;
(...)

in config.toml

## rain parameters ##
rainRate = 1.47 # mm/hr

[DiameterDistribution]
mean = 0.62818
stdev = 0.40985
(...)

What I have tried

even if I change the types into auto, it still gives the error

System Specification

cmake 3.11.1
gcc/g++ 6.4.0
Ubuntu 18.04

I figured it out. It should be t.get_qualified_as<...>
by the way, float is not a supported type.