#13307 closed Bugs (fixed)

multi_index_container can't work with _com_ptr_t

Reported by: andrewaa59@… Owned by: Joaquín M López Muñoz
Milestone: To Be Determined Component: multi_index
Version: Boost 1.60.0 Severity: Problem
Keywords: c++ Visual Studio _com_ptr_t Cc:


I try to use multi_index_container with _com_ptr_t objects. I can compile code with no errors, but program crashes in runtime.

Standard containers (std::map, std::set, std::vector) work perfectly with _com_ptr_t.

The sample code:

#include "stdafx.h"
#include <boost\multi_index_container.hpp>
#include <boost\multi_index\random_access_index.hpp>
#include <boost\multi_index\global_fun.hpp>
#include <boost\multi_index\ordered_index.hpp>

#import "C:\Windows\SysWOW64\msxml6.dll" exclude("ISequentialStream", "_FILETIME")

using CTest = 

int main()

	CTest tst;

	MSXML2::IXMLDOMDocumentPtr doc;

	**tst.push_back(std::move(doc));** <-- crash here


  return 0;

Change History (7)

comment:1 Changed 11 months ago by andrewaa59gmail.com

Component: Nonemulti_index
Owner: set to Joaquín M López Muñoz

comment:2 Changed 11 months ago by Andrey Alifanov <andrewaa59gmail.com>

Keywords: c++ Visual Studio _com_ptr_t added

comment:3 Changed 11 months ago by Joaquín M López Muñoz

Hi Andrey

I think the issue is solved by these two commits:

Would you mind patching your local installation of Boost with these and checking whether things work now? The only part where things will still go wrong with overloaded operator& is serialization, but seems the author is working on this in parallel.

Thank you,

comment:4 Changed 11 months ago by anonymous

Hi Joaquin

I'll try it as soon as possible and report about results. Thank you very much for amazingly quick fix.

comment:5 Changed 11 months ago by andrewaa59@…

Hi Joaquin.

Anonym - it was me. Very strange UI here.

I've tried your fix on my sample code - it seems to be working. At Monday I'll try it on real big code.

comment:6 Changed 11 months ago by andrewaa59@…

Hi Joaquin.

I've tried fix in real code - it's working. Thank you very much.

comment:7 Changed 11 months ago by Joaquín M López Muñoz

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.