Screenplay: Pointer Arithmetic, And Algorithms ============================================== * Base this on :doc:`pointer-arith-difference` * Leave ``begin`` and ``end`` in place .. literalinclude:: code/pointer-arith-algo-print.cpp :language: c++ :caption: :download:`code/pointer-arith-algo-print.cpp` * Transform to ``sum`` .. literalinclude:: code/pointer-arith-algo-sum.cpp :language: c++ :caption: :download:`code/pointer-arith-algo-sum.cpp` * Transform to ``sum()`` function .. literalinclude:: code/pointer-arith-algo-sum-func.cpp :language: c++ :caption: :download:`code/pointer-arith-algo-sum-func.cpp` * Transform to ``copy()`` .. literalinclude:: code/pointer-arith-algo-copy-func.cpp :language: c++ :caption: :download:`code/pointer-arith-algo-copy-func.cpp` * Transform to :doc:`range based for ` .. literalinclude:: code/pointer-arith-algo-copy-func-range-based.cpp :language: c++ :caption: :download:`code/pointer-arith-algo-copy-func-range-based.cpp`