[問題] const pointer & pointer to const
各位先進打擾了
其實已大概了解兩者之間的差異
最主要是想請C++ primer 5e的部分內容
在書中介紹const pointer的定義是無法修改pointer的存的值
https://imgur.com/WVNrENJ

另外也提到const_iterator本身是一個const pointer?
https://imgur.com/tmwALqV

這部分就使我搞混
因為既然是const pointer的話 對其值的修改應該是不允許才對
但編譯器(x86_64-w64-mingw32)卻允許
https://imgur.com/JxdG2OC

在這請叫各位先進說是否有理解錯誤的地方
非常感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.161.230.188 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1568346310.A.19D.html
※ 編輯: Tverous (1.161.230.188 臺灣), 09/13/2019 11:46:09
※ 編輯: Tverous (140.119.96.107 臺灣), 09/13/2019 11:48:06
※ 編輯: Tverous (140.119.96.107 臺灣), 09/13/2019 11:49:56
→
09/13 12:00,
6年前
, 1F
09/13 12:00, 1F
→
09/13 12:04,
6年前
, 2F
09/13 12:04, 2F
→
09/13 12:07,
6年前
, 3F
09/13 12:07, 3F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章