digitalmars.D - Argument of template as method of the object (How to replace the macros)
Hello! Say me please, what the best way to replace the next C++ macros (code from BerkeleyDB) in D: #define WRAPPED_CLASS(_WRAPPER_CLASS, _IMP_CLASS, _WRAPPED_TYPE) \ class _IMP_CLASS {}; \ \ inline _WRAPPED_TYPE *unwrap(_WRAPPER_CLASS *val) \ { \ if (!val) return (0); \ } \ \ inline const _WRAPPED_TYPE *unwrapConst(const _WRAPPER_CLASS *val) \ { \ if (!val) return (0); \ } I'm already search several hours but can't find good example in the documentation. Thank you in advance.
Oct 29 2011
unDEFER Wrote:Hello! Say me please, what the best way to replace the next C++ macros (code from BerkeleyDB) in D: #define WRAPPED_CLASS(_WRAPPER_CLASS, _IMP_CLASS, _WRAPPED_TYPE) \ class _IMP_CLASS {}; \ \ inline _WRAPPED_TYPE *unwrap(_WRAPPER_CLASS *val) \ { \ if (!val) return (0); \ } \ \ inline const _WRAPPED_TYPE *unwrapConst(const _WRAPPER_CLASS *val) \ { \ if (!val) return (0); \ } I'm already search several hours but can't find good example in the documentation. Thank you in advance.try val.get!(_WRAPPED_TYPE)
Oct 29 2011
Kagamin wrote:try val.get!(_WRAPPED_TYPE)Oh, yes, it will works. Big thanks. I just started my practice with D, and yet don't accustomed to its way, but it is great. Thank you again!
Oct 29 2011