Skip to content

Conversation

@708yamaguchi
Copy link
Contributor

整数型の変数やコンテナ型の変数の中身を簡単に見やすく表示するマクロを追加しました。

複数文に渡るマクロはdo-whileで囲わないと文字列を置換した時に予期せぬエラーを起こす可能性があるらしいので、少し長いですがdo-whileで囲っておきました。
https://www.jpcert.or.jp/sc-rules/c-pre10-c.html

今の状態では、表示可能/不可能な型は以下のとおりです。
表示可能

  • int
  • vector
  • string
  • deque
  • array
  • 固定長配列

表示不可能

  • map
  • set

mapに関しては、<<演算子をpair型用にオーバーロードしたら表示できるようになります。
setに関しては、check_vの中のfor文を(auto it=vec.begin(); it!=vec.end(); it++)としたら表示できるようになりますが、そうすると固定長配列が表示できなくなるので難しいところです。

@708yamaguchi
Copy link
Contributor Author

thanks to @ykawamura96

Copy link
Owner

@itohdak itohdak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ところで,この書き方だと,

ve: [ 0 1 2 3 4 5 6 7 8 9 ]
     ^                   ^

みたいに最初と最後に空白入っちゃうけど,いいんだっけ?

@708yamaguchi
Copy link
Contributor Author

ve: [ 0 1 2 3 4 5 6 7 8 9 ]
     ^                   ^

この書き方についてなんだけど、マクロを短くするためにこういう書き方をしてしまった。
最初と最後の空白はない方が見やすいと思うだけど、地味にプログラムが煩雑になりそうで、迷ってた。

どうしましょう?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants