关于const_cast转换

第一次看到const_cast转换,将const指针转换成普通的指针。很自然的想到:什么时候用const_cast?为什么要用它?这根const不是相互矛盾吗?

(const_cast<ICefRequest*>(request))->GetHeaderMap(map);

这篇文章讲的很好,一般在跟第三方库交互时,在必要的时候将库的const指针转换成普通指针来使用。
http://blog.aaronballman.com/2011/06/when-should-you-use-const_cast/

我只能说这样的库设计的不好!

原文地址:https://www.cnblogs.com/swnuwangyun/p/3771266.html