Add const version

refer to comment #3263a402897688904dedae8ba745ffdd8d99878f