- 464 名前:デフォルトの名無しさん mailto:sage [2007/11/28(水) 20:13:12 ]
- アルゴリズムだけ書いた
/* template/strcpy.cpp */ #ifdef XCS_IS_CHAR #define char_t char #define xcscpy_ strcpy #define text_( text ) text #endif #ifdef XCS_IS_WCHAR #define char_t wchar_t #define xcscpy_ wcscpy #define text_( text ) L ## text #endif /* strcpy, wcscpy */ char_t *xcscpy_( char_t *dst_, const char_t *src_ ){ char_t *head = dst_; while( text_('\0') != (*dst_++ = *src_++) ){ /* nop */; } return head; } のようなテンプレートを用意して /* strcpy.cpp */ #define XCS_IS_WCHAR #include <template/strcpy.cpp> /* wcscpy.cpp */ #define XCS_IS_CHAR #include <template/strcpy.cpp> と読み込ませるので、どちらが良いと思いますか? あるいは、もっと良い方法がありますか?
|

|