Boost logo

Boost :

From: Paul A. Bristow (boost_at_[hidden])
Date: 2003-07-17 10:09:08


Sadly the test program fails to compile MSVC 7.1 as indicated below:

template<typename Ch, typename Tr = std::char_traits<Ch> >
struct basic_string_source
    : private base_from_member< std::basic_string<Ch, Tr> >,
      public iterator_source<
                 typename std::basic_string<Ch, Tr>::iterator,
                 Ch, Tr
>
{
    typedef std::basic_string<Ch, Tr> string_type;
    typedef typename string_type::iterator iterator;
    typedef iterator_source<iterator, Ch, Tr> base_type;
    typedef Ch char_type;
    typedef Tr traits_type;
    typedef source_tag io_category;
    basic_string_source(const string_type& source)
        : base_type(member.begin(), member.end())
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    { }
};

|
| I have posted a new version of my library, which has been rewritten to
| incorporate filtering as a basic construct.
| (http://groups.yahoo.com/group/boost/files/streambuf_lib.zip)

with member not found

Looks as though it should be source.begin() but that doesn't compile either:

J:\Cpp\streambuf_lib\boost\io\adapters.hpp(159) : error C2664:
'boost::io::iterator_source<InIt,Ch,Tr>::iterator_source(InIt,InIt)' : cannot
convert parameter 1 from 'std::basic_string<_Elem,_Traits,_Ax>::const_iterator'
to 'std::basic_string<_Elem,_Traits,_Ax>::iterator'
        with
        [

InIt=std::basic_string<char,std::char_traits<char>,std::allocator<char>>::iterat
or,
            Ch=char,
            Tr=std::char_traits<char>
        ]
        and
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
        and
        [
            _Elem=char,
            _Traits=std::char_traits<char>,
            _Ax=std::allocator<char>
        ]
        No constructor could take the source type, or constructor overload
resolution was ambiguous
        J:\Cpp\streambuf_lib\boost\io\adapters.hpp(158) : while compiling
class-template member function
'boost::io::basic_string_source<Ch>::basic_string_source(const
boost::io::basic_string_source<Ch>::string_type &)'
        with
        [
            Ch=char
        ]
        testStreambuf_lib.cpp(57) : see reference to class template
instantiation 'boost::io::basic_string_source<Ch>' being compiled
        with
        [
            Ch=char
        ]

There are also zillions of warnings

j:\Cpp\streambuf_lib\boost\io\chains.hpp(267) : warning C4224: nonstandard
extension used : formal parameter 'chain' was previously defined as a type
        j:\Cpp\streambuf_lib\boost\io\chains.hpp(271) : see reference to class
template instantiation 'boost::io::chain_client<Ch,Tr>' being compiled

MS 'Help' says:

nonstandard extension used : formal parameter 'identifier' was previously
defined as a type
The identifier was previously used as a typedef. This causes a warning under
ANSI compatibility (/Za).

Example
// C4224.cpp
// compile with: /Za /W1 /LD
typedef int I;
void func ( int I ); // C4224

Suggestions?

It would be nice if a working example of a filter was provided too - perhaps one
of the James Kanze examples like 'expand tabs to spaces'. Or is this an
exercise for the student?

Thanks

Paul

Paul A Bristow, Prizet Farmhouse, Kendal, Cumbria, LA8 8AB UK
+44 1539 561830 Mobile +44 7714 33 02 04
Mobile mailto:pabristow_at_[hidden]
mailto:pbristow_at_[hidden]


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