[過去ログ]
C++相談室 part165 (1002レス)
C++相談室 part165 http://mevius.5ch.net/test/read.cgi/tech/1698705458/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
レス栞
このスレッドは過去ログ倉庫に格納されています。
次スレ検索
歴削→次スレ
栞削→次スレ
過去ログメニュー
317: デフォルトの名無しさん (ワッチョイ c3c9-hAMa) [sage] 2024/04/09(火) 20:10:25.18 ID:T/amOWJO0 とあるtemplateの関数を実装しているのですが、 const指定の振る舞いがよくわからなくなったので 質問させてください。 以下の(だいぶ簡略化した)コードで、 f_without_const<const int*>(const int* a) はコンパイルが通るのですが f_with_const<int*>(const int* a) がコンパイルが通らないのは何故でしょうか。 https://wandbox.org/permlink/OIgKM2DTqvpGduRV http://mevius.5ch.net/test/read.cgi/tech/1698705458/317
319: デフォルトの名無しさん (ワッチョイ 2790-Bmwq) [sage] 2024/04/09(火) 21:45:08.71 ID:+RmfoJzl0 >>317 templateは型が違うと全くの別物として処理するからだと思う http://mevius.5ch.net/test/read.cgi/tech/1698705458/319
320: デフォルトの名無しさん (ワッチョイ 7b10-qE2a) [sage] 2024/04/09(火) 22:00:45.26 ID:5hAg3cgl0 >>317 template <class T> void f_with_const (const T t); これに対応させるなら f_with_const<int*>(int *const a) http://mevius.5ch.net/test/read.cgi/tech/1698705458/320
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.056s