Giter Site home page Giter Site logo

Comments (6)

rnburn avatar rnburn commented on June 4, 2024

In this code

template <typename ValueType, typename KeyType, typename DefaultValueType>
ValueType findOrDefault(const YAML::Node& node,
                        KeyType&& key,
                        DefaultValueType&& defaultValue)
{
    const auto valueNode = node[key];
    if (!valueNode.IsDefined()) {
        return defaultValue;
    }
    return valueNode.template as<ValueType>();
}

DefaultValueType will be a reference. I think what you want is

return valueNode.template as<typename std::decay<ValueType>::type>();

from jaeger-client-cpp.

rnburn avatar rnburn commented on June 4, 2024

Or just change to not use a forwarding reference. It's not like your modifying key or defaultValue.

from jaeger-client-cpp.

rnburn avatar rnburn commented on June 4, 2024

cc @isaachier

from jaeger-client-cpp.

black-adder avatar black-adder commented on June 4, 2024

A PR would be much appreciated :)

from jaeger-client-cpp.

rnburn avatar rnburn commented on June 4, 2024

I put in #11. I don't know that it fixes the issue, but it will at least prevent you from trying to cast to reference types.

I expect the yaml-cpp API might require you to check the type before call as.

from jaeger-client-cpp.

isaachier avatar isaachier commented on June 4, 2024

Ya I'm considering giving up yaml-cpp in favor of nlohmann/json. The only concern is the compatibility with Go configs, but I think converting YAML to JSON is no big deal.

from jaeger-client-cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.