Download presentation
Presentation is loading. Please wait.
Published byἈρχιμήδης Κοντόσταυλος Modified over 5 years ago
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; ... }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.