Passing optional parameter by reference in c++

后端 未结 10 1839
天涯浪人
天涯浪人 2020-12-02 22:39

I\'m having a problem with optional function parameter in C++

What I\'m trying to do is to write function with optional parameter which is passed by reference, so th

10条回答
  •  情歌与酒
    2020-12-02 23:02

    void foo(double &bar,
             double &foobar = const_cast(static_cast(0.0)))
    {
       bar = 100;
       foobar = 150;
    }
    

提交回复
热议问题