相关疑难解决方法(0)

为什么这个constexpr静态成员函数在被调用时不被视为constexpr?

为什么这个constexpr static//! Nah注释标识的成员函数constexpr在调用时看不到?

struct Item_id
{
    enum Enum
    {
        size, position, attributes, window_rect, max_window_size, _
    };

    static constexpr int n_items_ = _;                          // OK
    constexpr auto member_n_items() const -> int { return _; }  // OK
    static constexpr auto static_n_items() -> int { return _; } // OK
    static constexpr int so_far = n_items_;                     // OK
    #ifndef OUT_OF_CLASS
        static constexpr int bah = static_n_items();            //! Nah.
    #endif
};

constexpr auto n_ids() -> int { …
Run Code Online (Sandbox Code Playgroud)

c++ constexpr

17
推荐指数
2
解决办法
1904
查看次数

标签 统计

c++ ×1

constexpr ×1