On Monday 21 October 2002 5:36 pm, Andre Poenitz wrote:
> On Mon, Oct 21, 2002 at 05:30:02PM +0100, Angus Leeming wrote:
> > Sorry, I should point out that this dies:
> > typedef boost::function2<int, const char *, char *const []>
> > but this is Ok:
> > typedef boost::function2<int, const char *, char *const *>
> >
> > Any ideas?
>
> foo[] _is_ different from foo*.
>
> Often [] 'collapses' to *, but when determining the signature
> of the template it does not.
>
> For a fixed number of entries you could use
>
> typedef boost::function2<int, const char *, char *const [10]>
> typedef boost::function2<int, const char *, char *const [20]>
>
> etc, but for "the other cases" you have to "collaps"
> yourself. "unspecified" length as in char *const [] is not
> possible.
>
> But I am here on shaky ground, this is all "I think, IMO,
> maybe..."
>
> Andre'
Hmmm. Try this minimal test case:
Angus
#include <boost/function/function2.hpp>
#include <unistd.h>
int main ()
{
const int MAX_ARGV = 255;
char *syscmd = 0;
char *argv[MAX_ARGV];
// works
// typedef boost::function2<int, const char *, char * const *> func_type;
// triggers internal compiler error
typedef boost::function2<int, const char *, char * const [255]> func_type;
func_type func = execvp;
func(syscmd, argv);
return 0;
}