Can I declare only specific elements of an array as constant? (C/C++/Fortran) -


scenario: pass e.g. 2d matrix argument in function , able read , change elements, but i prevent accidental writting in let's last column. somehow tell compiler use specific elements in function constant.

probably can't done useful in scenarios.

an array contiguous block of objects of common type; suggesting not supported.

the appropriate solution encapsulate array , access through functions can apply required semantics. in fact if used c++ encapsulate in class [] operator overloaded can apply semantics require while still using array access notation.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -