Boost logo

Boost Users :

From: Jens Theisen (jth01_at_[hidden])
Date: 2006-02-21 18:11:00


Meryl wrote:

> My case is using a vector of a pointer of a Class say 'A' which that
> class's constructor is private.

The following is working for me:

#include <iostream>
#include <vector>
#include <algorithm>
#include <boost/bind.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>

namespace lambda = boost::lambda;

struct A
{
private:
  A();
  };

void dummy(A const& c) { }

int main() {
    std::vector<A*> v;
    std::for_each
       ( v.begin(), v.end(), bind
           ( &dummy, *lambda::_1 ) );
}

Do you have a test case?

Jens


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net