Git Product home page Git Product logo

ptr_container's Introduction

PtrContainer, part of collection of the Boost C++ Libraries, provides containers for holding heap-allocated objects in an exception-safe manner and with minimal overhead.

License

Distributed under the Boost Software License, Version 1.0.

Properties

  • C++03
  • Header Only

Build Status

Branch GHA CI Appveyor Coverity Scan codecov.io Deps Docs Tests
master Build Status Build status Coverity Scan Build Status codecov Deps Documentation Enter the Matrix
develop Build Status Build status Coverity Scan Build Status codecov Deps Documentation Enter the Matrix

Directories

Name Purpose
doc documentation
include headers
test unit tests

More information

  • Ask questions
  • Report bugs: Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well.
  • Submit your patches as pull requests against develop branch. Note that by submitting patches you agree to license your modifications under the Boost Software License, Version 1.0.
  • Discussions about the library are held on the Boost developers mailing list. Be sure to read the discussion policy before posting and add the [ptr_container] tag at the beginning of the subject line.

ptr_container's People

Contributors

beman avatar benpope avatar cstratopoulos avatar dabrahams avatar danielae avatar danieljames avatar douggregor avatar eldiener avatar eyas avatar flamefire avatar grafikrobot avatar imikejackson avatar jeking3 avatar jhunold avatar joaquintides avatar jwakely avatar lastique avatar morinmorin avatar oe1rsa avatar pdimov avatar rogeeff avatar romain-geissler-1a avatar steveire avatar straszheim avatar theidexisted avatar thorsten-ottosen avatar vprus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ptr_container's Issues

UBSAN identified issues with new CI framework

Three issues found so disabling the UBSAN build job for now.

testing.capture-output ../../bin.v2/libs/ptr_container/test/ptr_inserter.test/gcc-7/debug/cxxstd-03-iso/ptr_inserter.run
====== BEGIN OUTPUT ======
../../boost/ptr_container/detail/void_ptr_iterator.hpp:68:49: runtime error: reference binding to null pointer of type 'int'
    #0 0x410d48 in boost::void_ptr_iterator<std::_List_iterator<void*>, int>::operator*() const (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_inserter.test/gcc-7/debug/cxxstd-03-iso/ptr_inserter+0x410d48)
    #1 0x4107a9 in int const* boost::ptr_container_detail::sequence_config<boost::nullable<int>, std::list<void*, std::allocator<void*> > >::get_const_pointer<boost::void_ptr_iterator<std::_List_iterator<void*>, int> >(boost::void_ptr_iterator<std::_List_iterator<void*>, int>) (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_inserter.test/gcc-7/debug/cxxstd-03-iso/ptr_inserter+0x4107a9)
    #2 0x40f6dd in void boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<boost::nullable<int>, std::list<void*, std::allocator<void*> > >, boost::heap_clone_allocator>::remove<boost::void_ptr_iterator<std::_List_iterator<void*>, int> >(boost::void_ptr_iterator<std::_List_iterator<void*>, int>) (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_inserter.test/gcc-7/debug/cxxstd-03-iso/ptr_inserter+0x40f6dd)
    #3 0x40decc in void boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<boost::nullable<int>, std::list<void*, std::allocator<void*> > >, boost::heap_clone_allocator>::remove<boost::void_ptr_iterator<std::_List_iterator<void*>, int> >(boost::void_ptr_iterator<std::_List_iterator<void*>, int>, boost::void_ptr_iterator<std::_List_iterator<void*>, int>) (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_inserter.test/gcc-7/debug/cxxstd-03-iso/ptr_inserter+0x40decc)
    #4 0x40c4e3 in boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<boost::nullable<int>, std::list<void*, std::allocator<void*> > >, boost::heap_clone_allocator>::remove_all() (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_inserter.test/gcc-7/debug/cxxstd-03-iso/ptr_inserter+0x40c4e3)
    #5 0x40acd9 in boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<boost::nullable<int>, std::list<void*, std::allocator<void*> > >, boost::heap_clone_allocator>::~reversible_ptr_container() (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_inserter.test/gcc-7/debug/cxxstd-03-iso/ptr_inserter+0x40acd9)
    #6 0x408b75 in boost::ptr_sequence_adapter<boost::nullable<int>, std::list<void*, std::allocator<void*> >, boost::heap_clone_allocator>::~ptr_sequence_adapter() (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_inserter.test/gcc-7/debug/cxxstd-03-iso/ptr_inserter+0x408b75)
    #7 0x408c0b in boost::ptr_list<boost::nullable<int>, boost::heap_clone_allocator, std::allocator<void*> >::~ptr_list() (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_inserter.test/gcc-7/debug/cxxstd-03-iso/ptr_inserter+0x408c0b)
    #8 0x40974f in void test_ptr_inserter_helper<boost::ptr_list<boost::nullable<int>, boost::heap_clone_allocator, std::allocator<void*> > >() (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_inserter.test/gcc-7/debug/cxxstd-03-iso/ptr_inserter+0x40974f)
    #9 0x40650f in test_ptr_inserter() test/ptr_inserter.cpp:73
    #10 0x40f38f in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_inserter.test/gcc-7/debug/cxxstd-03-iso/ptr_inserter+0x40f38f)
    #11 0x537908 in boost::function0<void>::operator()() const ../../boost/function/function_template.hpp:768
    #12 0x581e66 in boost::detail::forward::operator()() ../../boost/test/impl/execution_monitor.ipp:1310
    #13 0x5846a2 in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) ../../boost/function/function_template.hpp:138
    #14 0x584140 in boost::function0<int>::operator()() const ../../boost/function/function_template.hpp:769
    #15 0x582752 in int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()> >(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) ../../boost/test/impl/execution_monitor.ipp:285
    #16 0x57e9db in boost::execution_monitor::catch_signals(boost::function<int ()> const&) ../../boost/test/impl/execution_monitor.ipp:874
    #17 0x57eccc in boost::execution_monitor::execute(boost::function<int ()> const&) ../../boost/test/impl/execution_monitor.ipp:1213
    #18 0x580dd4 in boost::execution_monitor::vexecute(boost::function<void ()> const&) ../../boost/test/impl/execution_monitor.ipp:1319
    #19 0x573857 in boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned int) ../../boost/test/impl/unit_test_monitor.ipp:46
    #20 0x5354c8 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned int, boost::unit_test::framework::state::random_generator_helper const*) ../../boost/test/impl/framework.ipp:786
    #21 0x534b64 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned int, boost::unit_test::framework::state::random_generator_helper const*) ../../boost/test/impl/framework.ipp:734
    #22 0x534b64 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned int, boost::unit_test::framework::state::random_generator_helper const*) ../../boost/test/impl/framework.ipp:734
    #23 0x5251d0 in boost::unit_test::framework::run(unsigned long, bool) ../../boost/test/impl/framework.ipp:1619
    #24 0x45e7e1 in boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) ../../boost/test/impl/unit_test_main.ipp:231
    #25 0x45f287 in main ../../boost/test/impl/unit_test_main.ipp:284
    #26 0x7f16214b9f44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f44)
    #27 0x406458  (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_inserter.test/gcc-7/debug/cxxstd-03-iso/ptr_inserter+0x406458)
EXIT STATUS: 1
====== END OUTPUT ======
testing.capture-output ../../bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array.run
====== BEGIN OUTPUT ======
../../boost/ptr_container/detail/void_ptr_iterator.hpp:68:49: runtime error: reference binding to null pointer of type 'struct Base'
    #0 0x42a6bc in boost::void_ptr_iterator<void**, test::Base>::operator*() const (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array+0x42a6bc)
    #1 0x433135 in test::Base const* boost::ptr_container_detail::sequence_config<test::Base, boost::ptr_container_detail::ptr_array_impl<void*, 10ul, int> >::get_const_pointer<boost::void_ptr_iterator<void**, test::Base> >(boost::void_ptr_iterator<void**, test::Base>) (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array+0x433135)
    #2 0x432093 in void boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<test::Base, boost::ptr_container_detail::ptr_array_impl<void*, 10ul, int> >, boost::heap_clone_allocator>::remove<boost::void_ptr_iterator<void**, test::Base> >(boost::void_ptr_iterator<void**, test::Base>) (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array+0x432093)
    #3 0x42e854 in void boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<test::Base, boost::ptr_container_detail::ptr_array_impl<void*, 10ul, int> >, boost::heap_clone_allocator>::remove<boost::void_ptr_iterator<void**, test::Base> >(boost::void_ptr_iterator<void**, test::Base>, boost::void_ptr_iterator<void**, test::Base>) (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array+0x42e854)
    #4 0x4292ab in boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<test::Base, boost::ptr_container_detail::ptr_array_impl<void*, 10ul, int> >, boost::heap_clone_allocator>::remove_all() (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array+0x4292ab)
    #5 0x41fe4c in boost::ptr_container_detail::reversible_ptr_container<boost::ptr_container_detail::sequence_config<test::Base, boost::ptr_container_detail::ptr_array_impl<void*, 10ul, int> >, boost::heap_clone_allocator>::~reversible_ptr_container() (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array+0x41fe4c)
    #6 0x411439 in boost::ptr_sequence_adapter<test::Base, boost::ptr_container_detail::ptr_array_impl<void*, 10ul, int>, boost::heap_clone_allocator>::~ptr_sequence_adapter() (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array+0x411439)
    #7 0x4114cf in boost::ptr_array<test::Base, 10ul, boost::heap_clone_allocator>::~ptr_array() (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array+0x4114cf)
    #8 0x4209cd in std::auto_ptr<boost::ptr_array<test::Base, 10ul, boost::heap_clone_allocator> >::~auto_ptr() (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array+0x4209cd)
    #9 0x429bc7 in boost::ptr_sequence_adapter<test::Base, boost::ptr_container_detail::ptr_array_impl<void*, 10ul, int>, boost::heap_clone_allocator>::ptr_sequence_adapter<boost::ptr_array<test::Base, 10ul, boost::heap_clone_allocator> >(std::auto_ptr<boost::ptr_array<test::Base, 10ul, boost::heap_clone_allocator> >) (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array+0x429bc7)
    #10 0x420b7f in boost::ptr_array<test::Base, 10ul, boost::heap_clone_allocator>::ptr_array(std::auto_ptr<boost::ptr_array<test::Base, 10ul, boost::heap_clone_allocator> >) (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array+0x420b7f)
    #11 0x411bf3 in void test_array_interface<boost::ptr_array<test::Base, 10ul, boost::heap_clone_allocator>, test::Base, test::Derived_class>() (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array+0x411bf3)
    #12 0x40703c in test_array() test/ptr_array.cpp:90
    #13 0x431738 in boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array+0x431738)
    #14 0x555716 in boost::function0<void>::operator()() const ../../boost/function/function_template.hpp:768
    #15 0x59fc74 in boost::detail::forward::operator()() ../../boost/test/impl/execution_monitor.ipp:1310
    #16 0x5a24b0 in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) ../../boost/function/function_template.hpp:138
    #17 0x5a1f4e in boost::function0<int>::operator()() const ../../boost/function/function_template.hpp:769
    #18 0x5a0560 in int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()> >(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) ../../boost/test/impl/execution_monitor.ipp:285
    #19 0x59c7e9 in boost::execution_monitor::catch_signals(boost::function<int ()> const&) ../../boost/test/impl/execution_monitor.ipp:874
    #20 0x59cada in boost::execution_monitor::execute(boost::function<int ()> const&) ../../boost/test/impl/execution_monitor.ipp:1213
    #21 0x59ebe2 in boost::execution_monitor::vexecute(boost::function<void ()> const&) ../../boost/test/impl/execution_monitor.ipp:1319
    #22 0x591665 in boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned int) ../../boost/test/impl/unit_test_monitor.ipp:46
    #23 0x5532d6 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned int, boost::unit_test::framework::state::random_generator_helper const*) ../../boost/test/impl/framework.ipp:786
    #24 0x552972 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned int, boost::unit_test::framework::state::random_generator_helper const*) ../../boost/test/impl/framework.ipp:734
    #25 0x552972 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned int, boost::unit_test::framework::state::random_generator_helper const*) ../../boost/test/impl/framework.ipp:734
    #26 0x542fde in boost::unit_test::framework::run(unsigned long, bool) ../../boost/test/impl/framework.ipp:1619
    #27 0x47c711 in boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) ../../boost/test/impl/unit_test_main.ipp:231
    #28 0x47d1b7 in main ../../boost/test/impl/unit_test_main.ipp:284
    #29 0x7f8fcb0b0f44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f44)
    #30 0x406868  (/home/travis/build/jeking3/boost-root/bin.v2/libs/ptr_container/test/ptr_array.test/gcc-7/debug/cxxstd-03-iso/ptr_array+0x406868)
EXIT STATUS: 1
====== END OUTPUT ======
testing.capture-output ../../bin.v2/libs/ptr_container/test/serialization.test/gcc-7/debug/cxxstd-03-iso/serialization.run
====== BEGIN OUTPUT ======
Segmentation fault (core dumped)
EXIT STATUS: 139
====== END OUTPUT ======

Documentation updates for PR #8

This issue is in reference to #8 which conditionally provides interfaces with auto_ptr or unique_ptr to work around auto_ptr deprecation with newer compilers.

If I understand correctly, this PR was too late for Boost 1.66 having been merged in late November, but it will be in Boost 1.67; moreover there is still time to submit documentation updates before the 1.67 release.

I noticed on the 1.67 beta snapshot documentation that auto_ptr is still uniformly referred to in documentation, with no mention of unique_ptr.

I'm opening this issue just to bring attention to this matter, but also maybe it's appropriate to have a discussion on how to treat this situation. One thought I had was that in other projects it's common practice to use a special identifier like implementation-defined in lieu of actual object types, with a documentation page explaining its meaning. Maybe auto_ptr<T> could be replaced with something like smart-pointer-type<T>, with a documentation page explaining that Boost.Config will be used to resolve this to either auto_ptr<T> or unique_ptr<T> depending on compiler standard? Maybe it would be appropriate to add this to an "Upgrading from Boost v. 1.66.*" heading, along the lines of similarly named headings on the documentation homepage.

cl-clang: test_serialization: class boost::archive::archive_exception: unregistered class - derived class not registered or exported

New issue uncovered by adding a cl-clang Appveyor build job:

https://ci.appveyor.com/project/jeking3/ptr-container-lviqw/builds/25773256/job/uvt8w5fjj452kjw4#L1554

testing.capture-output bin.v2\libs\ptr_container\test\serialization.test\clang-win-8.0.0\release\address-model-64\cxxstd-11-iso\threading-multi\serialization.run
====== BEGIN OUTPUT ======
Running 1 test case...
unknown location(0): fatal error: in "Pointer Container Test Suite/test_serialization": class boost::archive::archive_exception: unregistered class - derived class not registered or exported
*** 1 failure is detected in the test module "Master Test Suite"
 
EXIT STATUS: 201 
====== END OUTPUT ======
    set Path=C:\projects\boost-root\bin.v2\libs\serialization\build\clang-win-8.0.0\release\address-model-64\cxxstd-11-iso\threading-multi;%Path%
    set status=0
    if %status% NEQ 0 (
        echo Skipping test execution due to testing.execute=off
        exit 0
    )
     "bin.v2\libs\ptr_container\test\serialization.test\clang-win-8.0.0\release\address-model-64\cxxstd-11-iso\threading-multi\serialization.exe"   > "bin.v2\libs\ptr_container\test\serialization.test\clang-win-8.0.0\release\address-model-64\cxxstd-11-iso\threading-multi\serialization.output" 2>&1 
    set status=%ERRORLEVEL%
    echo. >> "bin.v2\libs\ptr_container\test\serialization.test\clang-win-8.0.0\release\address-model-64\cxxstd-11-iso\threading-multi\serialization.output"
    echo EXIT STATUS: %status% >> "bin.v2\libs\ptr_container\test\serialization.test\clang-win-8.0.0\release\address-model-64\cxxstd-11-iso\threading-multi\serialization.output"
    if %status% EQU 0 (
        copy "bin.v2\libs\ptr_container\test\serialization.test\clang-win-8.0.0\release\address-model-64\cxxstd-11-iso\threading-multi\serialization.output" "bin.v2\libs\ptr_container\test\serialization.test\clang-win-8.0.0\release\address-model-64\cxxstd-11-iso\threading-multi\serialization.run"
    )
    set verbose=0
    if %status% NEQ 0 (
        set verbose=1
    )
    if %verbose% EQU 1 (
        echo ====== BEGIN OUTPUT ======
        type "bin.v2\libs\ptr_container\test\serialization.test\clang-win-8.0.0\release\address-model-64\cxxstd-11-iso\threading-multi\serialization.output"
        echo ====== END OUTPUT ======
    )
    exit %status%
...failed testing.capture-output bin.v2\libs\ptr_container\test\serialization.test\clang-win-8.0.0\release\address-model-64\cxxstd-11-iso\threading-multi\serialization.run...

Potential footgun in `ptr_map`

There is an easy risk of creating use-after-free errors with current implementation of iterators. This simple code:

auto it = map.find(key);
const auto &data = it->second;

The problem comes from iterator::operator-> returning temporary (proxy), where second is a value, and not reference. This means that as soon as the assignment to data ends, temporary is freed and our reference points to destroyed object. This will be also true for directly doing map.find(key)->second.

A full example on godbolt with enabled address sanitizer: https://godbolt.org/z/M9h43Pdd1

This problem is dangerous, because it doesn't generate any warning even with decently aggressive flags (on clang-15, -Wall -Wextra -Wpedantic). Moreover, same code for std::map works correctly.

I have no idea if this can be solved on the code level (i.e. if there is a value that could be referenced in that proxy instead of making a copy), or if only solution is just making sure documentation warns about this.

libs/ptr_container/test/serialization.cpp: failure with Linux 6.0 gcc 12.2.0 boost 1.81.0

testing.capture-output bin.v2/libs/ptr_container/test/serialization.test/gcc-12/release/threading-multi/visibility-hidden/serialization.run
====== BEGIN OUTPUT ======                                                                                                                                                                    
Running 1 test case...                                                                                                                                                                        
libs/ptr_container/test/serialization.cpp(206): error: in "Pointer Container Test Suite/test_serialization": check (*vec2.begin()).i == -1 has failed [0 != -1]
libs/ptr_container/test/serialization.cpp(207): error: in "Pointer Container Test Suite/test_serialization": check (*++vec2.begin()).i == 0 has failed [-1 != 0]
libs/ptr_container/test/serialization.cpp(206): error: in "Pointer Container Test Suite/test_serialization": check (*vec2.begin()).i == -1 has failed [0 != -1]
libs/ptr_container/test/serialization.cpp(207): error: in "Pointer Container Test Suite/test_serialization": check (*++vec2.begin()).i == 0 has failed [-1 != 0]
                                                                                                                                                                                              
*** 4 failures are detected in the test module "Master Test Suite"  

Boost\libs\ptr_container failed to build on MSVC

Issue description:
Boost\libs\ptr_container failed to build on MSVC. Could you please take a look? We ues boostorg/boost@0724ce0.

Build step:

  1. git clone -c core.autocrlf=true --recursive ​https://github.com/boostorg/boost.git boost
  2. open a VS 2019 x64 command prompt and browse to boost
  3. \bootstrap
  4. \b2 headers variant=release --build-dir=..\out\x64rel address-model=64
  5. \b2 variant=release --build-dir=..\out\x64rel address-model=64
  6. \b2 -j4 variant=release --build-dir=..\out\x64rel libs\ptr_container \test
    Error info:

Running 1 test case...
libs/ptr_container/test/serialization.cpp(206): error: in "Pointer Container Test Suite/test_serialization": check (vec2.begin()).i == -1 has failed [0 != -1]
libs/ptr_container/test/serialization.cpp(207): error: in "Pointer Container Test Suite/test_serialization": check (
++vec2.begin()).i == 0 has failed [-1 != 0]
libs/ptr_container/test/serialization.cpp(206): error: in "Pointer Container Test Suite/test_serialization": check (vec2.begin()).i == -1 has failed [0 != -1]
libs/ptr_container/test/serialization.cpp(207): error: in "Pointer Container Test Suite/test_serialization": check (
++vec2.begin()).i == 0 has failed [-1 != 0]
Detail log:
test.log.97.txt

Errors with boost(1.70.0) in using ptr_vector

I am moving from Boost 1.65.1 to 1.70.0. My project has the usage of "ptr_vector" in function parameter.
The build is failing in 1.70.0. I have written a program that demonstrates the problem in using "ptr_vector" in function parameter.

Command used for compiling:
g++ -std=c++14 ptr_vector_test.cpp -Iboost_1_70_0

Test Program:

#include <boost/ptr_container/ptr_vector.hpp>
namespace A
{
    template<class T>
    class Foo
    {
        public:
        static void test(boost::ptr_vector<Foo<T>>& t){
            return;
        }
    };
    template<class T>
    using test = boost::ptr_vector<Foo<T>>;
}

int main()
{

    A::test<double> ptr;
    return 0;
}

Error (On Linux : gcc 6.3.0)

ptr_vector_test.cpp: In instantiation of ‘class A::Foo<double>’:
boost_1_70_0/boost/ptr_container/nullable.hpp:55:13:   recursively required by substitution of ‘template<class T> boost::type_traits::yes_type boost::ptr_container_detail::is_nullable(const boost::nullable<T>*) [with T = <missing>]’
boost_1_70_0/boost/ptr_container/nullable.hpp:55:13:   required from ‘const bool boost::is_nullable<A::Foo<double> >::value’
boost_1_70_0/boost/mpl/if.hpp:63:11:   required from ‘struct boost::mpl::if_<boost::is_nullable<A::Foo<double> >, A::Foo<double>, boost::mpl::identity<A::Foo<double> > >’
boost_1_70_0/boost/mpl/eval_if.hpp:37:41:   required from ‘struct boost::mpl::eval_if<boost::is_nullable<A::Foo<double> >, A::Foo<double>, boost::mpl::identity<A::Foo<double> > >’
boost_1_70_0/boost/ptr_container/nullable.hpp:69:13:   required from ‘struct boost::remove_nullable<A::Foo<double> >’
boost_1_70_0/boost/ptr_container/nullable.hpp:80:55:   required from ‘struct boost::ptr_container_detail::void_ptr<A::Foo<double> >’
ptr_vector_test.cpp:18:43:   required by substitution of ‘template<class T> using test = boost::ptr_vector<A::Foo<T> > [with T = double]’
ptr_vector_test.cpp:26:19:   required from here
ptr_vector_test.cpp:11:21: error: no type named ‘type’ in ‘struct boost::ptr_container_detail::void_ptr<A::Foo<double> >’
         static void test(boost::ptr_vector<Foo<T>>& t){

Clang command:

clang++ -std=c++14 ptr_vector_test.cpp -Iboost_1_70_0

Error( On Clang):

In file included from ptr_vector_test.cpp:1:
boost_1_70_0/boost/ptr_container/ptr_vector.hpp:35:91: error: no type named 'type' in 'boost::ptr_container_detail::void_ptr<A::Foo<double> >'
        class Allocator      = std::allocator<typename ptr_container_detail::void_ptr<T>::type>
                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
ptr_vector_test.cpp:11:33: note: in instantiation of default argument for 'ptr_vector<A::Foo<double>, boost::heap_clone_allocator>' required here
        static void test(boost::ptr_vector<Foo<T>>& t){
                                ^~~~~~~~~~~~~~~~~~
boost_1_70_0/boost/ptr_container/nullable.hpp:55:57: note: in instantiation of template class 'A::Foo<double>' requested here
            BOOST_STATIC_CONSTANT(bool, value = sizeof( ptr_container_detail::is_nullable( var ) ) 
                                                        ^
boost_1_70_0/boost/mpl/if.hpp:63:68: note: in instantiation of template class 'boost::is_nullable<A::Foo<double> >' requested here
          BOOST_MPL_AUX_STATIC_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(T1)::value)
                                                                   ^
boost_1_70_0/boost/mpl/eval_if.hpp:37:22: note: in instantiation of template class 'boost::mpl::if_<boost::is_nullable<A::Foo<double> >, A::Foo<double>, boost::mpl::identity<A::Foo<double> > >' requested here
    typedef typename if_<C,F1,F2>::type f_;
                     ^
boost_1_70_0/boost/ptr_container/nullable.hpp:66:45: note: in instantiation of template class 'boost::mpl::eval_if<boost::is_nullable<A::Foo<double> >, A::Foo<double>, boost::mpl::identity<A::Foo<double> > >' requested here
        typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< is_nullable<T>,
                                            ^
boost_1_70_0/boost/ptr_container/nullable.hpp:79:61: note: in instantiation of template class 'boost::remove_nullable<A::Foo<double> >' requested here
                              BOOST_DEDUCED_TYPENAME boost::remove_nullable<T>::type >::value,
                                                            ^
boost_1_70_0/boost/ptr_container/ptr_vector.hpp:35:78: note: in instantiation of template class 'boost::ptr_container_detail::void_ptr<A::Foo<double> >' requested here
        class Allocator      = std::allocator<typename ptr_container_detail::void_ptr<T>::type>
                                                                             ^
ptr_vector_test.cpp:18:5: note: in instantiation of default argument for 'ptr_vector<A::Foo<double>, boost::heap_clone_allocator>' required here
    using test = boost::ptr_vector<Foo<T>>;
    ^~~~~
ptr_vector_test.cpp:26:8: note: in instantiation of template type alias 'test' requested here
    A::test<double> ptr;
       ^
1 error generated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.