Returning const array?

This is a discussion on Returning const array? within the C++ Programming forums, part of the General Programming Boards category; Is there a possibility to make it somehow, I need to return const bool[dimension1][dimension2]; I tried - template classes, pointers, ...

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    1

    Question Returning const array?

    Is there a possibility to make it somehow,

    I need to return const bool[dimension1][dimension2];

    I tried - template classes, pointers, and the other things, some that break the C++ standards, but no working solution.

    Thank you if you have any ideas.

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,170
    The best way is to pass the array into the function and modify it from there.
    Alternatively, use std::Tr1::array. Since it's an object, you can return it.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 09:42 PM
  2. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 01:03 AM
  3. Need help implementing a class
    By jk1998 in forum C++ Programming
    Replies: 8
    Last Post: 04-05-2007, 03:13 PM
  4. fatal error LNK1104
    By DMH in forum C++ Programming
    Replies: 2
    Last Post: 11-16-2005, 02:46 AM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21