Presentation is loading. Please wait.

Presentation is loading. Please wait.

Default argument 2019.06.13 Kei Hasegawa.

Similar presentations


Presentation on theme: "Default argument 2019.06.13 Kei Hasegawa."— Presentation transcript:

1 Default argument Kei Hasegawa

2 Not a type Bellow codes are error:
typedef void FUNC(int = 1); void (*pf)(int = 2); See ISO/IEC Default arguments So, bellow implementation is incorrect: class default_arg_type : public type { const type* m_T; var* m_default_arg; // default argument ... };

3 Example of implementation
struct usr : var { enum flag_t { ..., HAS_DEFAULT_ARG, ... }; flag_t m_flag; }; map<usr*, vector<var*> > default_arg_table; Maintain default arguments. A key of this table is function. usr* u = ... usr::flag_t flag = u->m_flag; if (flag & usr::HAS_DEFAULT_ARG) { p = default_arg_table.find(u); vecotr<var*>& v = p->second; ... }


Download ppt "Default argument 2019.06.13 Kei Hasegawa."

Similar presentations


Ads by Google