Boost logo

Boost :

From: michel.andre_at_[hidden]
Date: 2001-10-03 15:12:38


> There's nothing in the code which suggests it would do that. What
is your
> evidence?

Maybe there is something wrong with my config.

This program snippet gives me the following error:

#include <boost/config.hpp>
#include <list>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <string>
#include <boost/iterator_adaptors.hpp>

struct personnel_record {
  personnel_record(std::string n, int id) : m_name(n), m_ID(id) { }
  std::string m_name;
  int m_ID;
};

struct select_name {
  typedef personnel_record argument_type;
  typedef std::string result_type;
  const std::string& operator()(const personnel_record& r) const {
    return r.m_name;
  }
  std::string& operator()(personnel_record& r) const {
    return r.m_name;
  }
};

int main(int, char*[])
{
  std::list<personnel_record> personnel_list;
  personnel_list.push_back(personnel_record("Barney", 13423));
  
  boost::projection_iterator_generator<select_name,
std::list<personnel_record>::iterator>::type
    personnel_first(personnel_list.begin());
  std::cout << *personnel_first;
  return 0;
}

D:\User\Michel\Source\boost_test\boost_test.cpp(38) : error C2679:
binary '<<' : no operator defined which takes a right-hand operand of
type 'struct personnel_record' (or there is no acceptable conversion)

and
typeid(*personel_first).name()
gives me struct personnel_record
and
typeid(
  boost::projection_iterator_generator<select_name,
std::list<personnel_record>::iterator>::type::reference).name()
gives me struct personnel_record&

The only config i've change is to define
#define BOOST_NO_STDC_NAMESPACE
otherwise i'll get
d:\downloads\boost_1_25_0\boost\concept_check.hpp(570) : error
C2039: 'ptrdiff_t' : is not a member of 'std'

My dinkumware installation states V3.07

/Michel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk