Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2003-09-17 08:00:49

John Maddock ha escrito:

> > Having into account that the bug spans across several compilers
> > (at least two), is this important enough to deserve a defect macro
> > in Boost.Config? If so, I can provide a test for it.
> Looks like it: what do we call the macro? Do you want to supply the test
> program? (see Boost.config docs for the details),

Something like


(admittedly a little long, but cutting anything will lead to confusing
Please find test code at the end of this mail. Checked to work for g++3.2 under
Cygwin and to fail (as it should) in MSVC ++6.5 and Intel C++ 7.1 for Windows.

> BTW, we normally wait for libraries to be accepted before committing new
> config macros for them (sometimes the need for the macro goes away during
> the review).

Well, strictly speaking indexed_set does not rely on detecting this bug.
It simply provides a replacement member_offset<> for member<>; it is up
to the user to decide which want she should use. Of course, having this
macro in Boost could simplify things, at least from the usability point
of view.

(off-topic: allow me to invite you to take a look at the library, your opinions
and suggestions will be most welcome)


Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

*** CODE FOR boost_no_ptrs_to_mem_as_non_type_temp_args.cxx
// (C) Copyright Joaquín M López Muñoz 2003. Permission to copy, use, modify,
// sell and distribute this software is granted provided this copyright notice
// appears in all copies. This software is provided "as is" without express or
// implied warranty, and with no claim as to its suitability for any purpose.

// TITLE: pointers to members as non-type template arguments
// DESCRIPTION: Defective support for pointers to members as non-type template

namespace boost_no_pointers_to_members_as_non_type_template_arguments{

struct pair
  int x,y;

  pair(int x_,int y_):x(x_),y(y_){}

template<int pair::* PtrToPairMember>
struct foo
  int bar(pair& p){return p.*PtrToPairMember;}

int test()
  pair p(0,1);
  foo<&pair::x> fx;
  foo<&pair::y> fy;

  if(!=0||!=1)return -1;

  return 0;



Boost list run by bdawes at, gregod at, cpdaniel at, john at