Boost logo

Boost Users :

From: Paul O'Neill (paul.boost_at_[hidden])
Date: 2007-07-02 02:33:25


The following code will not compile in MSVC80. It seems to be caused by an
attempt to access a private member which is made public for the unit testing
and so may not be caught by the boost unit tests. This was compiled against
the Main CVS on 30-Jun-2007.

int main(int argc, char* argv[])
{
        boost::circular_buffer<int> cb(3);
        return 0;
}

A look at the m_it that is referenced (error log below) shows that it is
private in when BOOST_CB_TEST is not defined. If I define this macro
everything works as expected.

#if !defined(BOOST_CB_TEST)
private:
#endif // #if !defined(BOOST_CB_TEST)
// Member variables

    //! The circular buffer where the iterator points to.
    const Buff* m_buff;

    //! An internal iterator.
    pointer m_it;

Any ideas? Thanks, Paul.

1>c:\sdk\boost\boost cvs\boost\boost\circular_buffer\debug.hpp(133) : error
C2248: 'boost::cb_details::iterator<Buff,Traits>::m_it' : cannot access
private member declared in class 'boost::cb_details::iterator<Buff,Traits>'
1> with
1> [
1> Buff=boost::circular_buffer<int>,
1> Traits=boost::cb_details::nonconst_traits<std::allocator<int>>
1> ]
1> c:\sdk\boost\boost
cvs\boost\boost\circular_buffer\details.hpp(231) : see declaration of
'boost::cb_details::iterator<Buff,Traits>::m_it'
1> with
1> [
1> Buff=boost::circular_buffer<int>,
1> Traits=boost::cb_details::nonconst_traits<std::allocator<int>>
1> ]
1> c:\sdk\boost\boost cvs\boost\boost\circular_buffer\base.hpp(1950)
: see reference to function template instantiation 'void
boost::cb_details::debug_iterator_registry::invalidate_iterators<boost::cb_details::iterator<Buff,Traits>>(const
Iterator &)' being compiled
1> with
1> [
1> Buff=boost::circular_buffer<int>,
1>
Traits=boost::cb_details::nonconst_traits<std::allocator<int>>,
1>
Iterator=boost::cb_details::iterator<boost::circular_buffer<int>,boost::cb_details::nonconst_traits<std::allocator<int>>>
1> ]
1> c:\sdk\boost\boost cvs\boost\boost\circular_buffer\base.hpp(1947)
: while compiling class template member function 'void
boost::circular_buffer<T>::destroy_item(int *)'
1> with
1> [
1> T=int
1> ]
1> i:\development\projects\test\test\main2.cpp(6) : see reference to
class template instantiation 'boost::circular_buffer<T>' being compiled
1> with
1> [
1> T=int
1> ]

-- 
View this message in context: http://www.nabble.com/-circular_buffer--problem-compiling-in-VC80-tf4010271.html#a11388737
Sent from the Boost - Users mailing list archive at Nabble.com.

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