main.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* main.cpp :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2026/01/09 14:15:06 by bchanot #+# #+# */
  9. /* Updated: 2026/01/09 18:43:02 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "iter.hpp"
  13. class Test {
  14. public:
  15. Test(void) : _value(42) {return;};
  16. int getValue(void) const {return this->_value;};
  17. private:
  18. int _value;
  19. };
  20. std::ostream & operator<<( std::ostream & o, Test const & i ) {
  21. o << i.getValue();
  22. return o;
  23. }
  24. int main( void ) {
  25. int arr1[] = {1, 2, 3};
  26. int const arr2[] = {4, 5, 6};
  27. int arr3[] = {1, 2, 3, 4, 5};
  28. Test tab[5];
  29. iter(arr3, 5, printConst);
  30. iter(tab, 5, printConst);
  31. iter(arr1, 3, addTen);
  32. std::cout << arr1[0] << "; " << arr1[1] << "; " << arr1[2] << std::endl;
  33. iter(arr1, 3, printConst);
  34. iter(arr2, 3, printConst);
  35. iter(arr2, 3, print);
  36. }