Boost heterogeneous unit - Bar per Minute - c++

I need to create a unit which represents pressure per time, specifically Bar per Minute.
I tried creating it in the same way as I created similar units before:
typedef boost::units::derived_dimension<boost::units::length_base_dimension, -1,
boost::units::mass_base_dimension, 1,
boost::units::time_base_dimension, -3>::type pressure_roc_dimension;
typedef boost::units::unit<pressure_roc_dimension,
boost::units::make_system<boost::units::metric::bar_base_unit,
boost::units::metric::minute_base_unit>::type> bar_per_minute_unit;
BOOST_UNITS_STATIC_CONSTANT(BarPerMinute, bar_per_minute_unit::unit_type);
typedef boost::units::quantity<bar_per_minute_unit, double> BarPerMinuteRoC;
And then I try to use it:
BarPerMinuteRoC bpm = 5.0 * BarPerMinute;
But this line doesn't compile with quite a long error trail which I'm having a bit of trouble understanding fully.
1>c:\workspace\externals\boost_1_57_0\include\boost\units\detail\linear_algebra.hpp(197): error C2039: 'item' : is not a member of 'boost::units::dimensionless_type'
1> c:\workspace\externals\boost_1_57_0\include\boost\units\dimensionless_type.hpp(37) : see declaration of 'boost::units::dimensionless_type'
1> c:\workspace\externals\boost_1_57_0\include\boost\units\detail\linear_algebra.hpp(259) : see reference to class template instantiation 'boost::units::detail::determine_extra_equations_skip_zeros_impl<true,false>::apply<RowsBegin,1,1,3,Result>' being compiled
1> with
1> [
1> RowsBegin=boost::units::list<boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1,1>,boost::units::detail::make_zero_vector<0>::type>>,boost::units::detail::determine_extra_equations_skip_zeros_impl<false,true>::apply<boost::units::list<boost::units::list<boost::units::static_rational<-1,1>,boost::units::list<boost::units::static_rational<1,1>,boost::units::list<boost::units::static_rational<-2,1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::dimensionless_type>,1,0,3,boost::units::list<boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1,1>,boost::units::detail::make_zero_vector<0>::type>>>,boost::units::list<boost::units::list<boost::units::static_rational<-1,1>,boost::units::list<boost::units::static_rational<1,1>,boost::units::list<boost::units::static_rational<-2,1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::dimensionless_type>>>::next_equations>
1> , Result=boost::units::list<boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1,1>,boost::units::detail::make_zero_vector<0>::type>>>,boost::units::list<boost::units::list<boost::units::static_rational<-1,1>,boost::units::list<boost::units::static_rational<1,1>,boost::units::list<boost::units::static_rational<-2,1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::dimensionless_type>>
1> ]
1> c:\workspace\externals\boost_1_57_0\include\boost\units\detail\linear_algebra.hpp(264) : see reference to class template instantiation 'boost::units::detail::determine_extra_equations<2,false>::apply<boost::units::list<boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1,1>,boost::units::detail::make_zero_vector<0>::type>>,boost::units::detail::determine_extra_equations_skip_zeros_impl<false,true>::apply<boost::units::list<boost::units::list<boost::units::static_rational<-1,1>,boost::units::list<boost::units::static_rational<1,1>,boost::units::list<boost::units::static_rational<-2,1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::dimensionless_type>,1,0,3,Result>::next_equations>,3,Result>' being compiled
1> with
1> [
1> Result=boost::units::list<boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1,1>,boost::units::detail::make_zero_vector<0>::type>>>,boost::units::list<boost::units::list<boost::units::static_rational<-1,1>,boost::units::list<boost::units::static_rational<1,1>,boost::units::list<boost::units::static_rational<-2,1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::dimensionless_type>>
1> ]
1> c:\workspace\externals\boost_1_57_0\include\boost\units\detail\linear_algebra.hpp(538) : see reference to class template instantiation 'boost::units::detail::determine_extra_equations<3,false>::apply<Matrix,3,Matrix>' being compiled
1> with
1> [
1> Matrix=boost::units::list<boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1,1>,boost::units::detail::make_zero_vector<0>::type>>>,boost::units::list<boost::units::list<boost::units::static_rational<-1,1>,boost::units::list<boost::units::static_rational<1,1>,boost::units::list<boost::units::static_rational<-2,1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::dimensionless_type>>
1> ]
1> c:\workspace\externals\boost_1_57_0\include\boost\units\detail\linear_algebra.hpp(828) : see reference to class template instantiation 'boost::units::detail::make_square_and_invert<boost::units::list<boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<0,1>,boost::units::list<boost::units::static_rational<1,1>,boost::units::detail::make_zero_vector<0>::type>>>,boost::units::list<boost::units::list<boost::units::static_rational<-1,1>,boost::units::list<boost::units::static_rational<1,1>,boost::units::list<boost::units::static_rational<-2,1>,boost::units::detail::expand_dimensions<0>::apply<boost::units::dimensionless_type,boost::units::dimensionless_type>::type>>>,boost::units::dimensionless_type>>>' being compiled
1> c:\workspace\externals\boost_1_57_0\include\boost\units\detail\linear_algebra.hpp(1032) : see reference to class template instantiation 'boost::units::detail::normalize_units<T>' being compiled
1> with
1> [
1> T=boost::units::list<boost::units::scaled_base_unit<boost::units::si::second_base_unit,boost::units::scale<60,boost::units::static_rational<1,1>>>,boost::units::list<boost::units::metric::bar_base_unit,boost::units::dimensionless_type>>
1> ]
1> c:\workspace\externals\boost_1_57_0\include\boost\units\detail\linear_algebra.hpp(1051) : see reference to class template instantiation 'boost::units::detail::calculate_base_unit_exponents_impl<false>::apply<T,Dimensions>' being compiled
1> with
1> [
1> T=boost::units::list<boost::units::scaled_base_unit<boost::units::si::second_base_unit,boost::units::scale<60,boost::units::static_rational<1,1>>>,boost::units::list<boost::units::metric::bar_base_unit,boost::units::dimensionless_type>>
1> , Dimensions=BSII::Units::pressure_roc_dimension
1> ]
1> c:\workspace\externals\boost_1_57_0\include\boost\units\heterogeneous_system.hpp(243) : see reference to class template instantiation 'boost::units::detail::calculate_base_unit_exponents<boost::units::list<boost::units::scaled_base_unit<boost::units::si::second_base_unit,boost::units::scale<60,boost::units::static_rational<1,1>>>,boost::units::list<T,boost::units::dimensionless_type>>,Dimensions>' being compiled
1> with
1> [
1> T=boost::units::metric::bar_base_unit
1> , Dimensions=BSII::Units::pressure_roc_dimension
1> ]
1> c:\workspace\externals\boost_1_57_0\include\boost\units\unit.hpp(92) : see reference to class template instantiation 'boost::units::detail::make_heterogeneous_system<Dim,System>' being compiled
1> with
1> [
1> Dim=BSII::Units::pressure_roc_dimension
1> , System=boost::units::homogeneous_system<boost::units::list<boost::units::scaled_base_unit<boost::units::si::second_base_unit,boost::units::scale<60,boost::units::static_rational<1,1>>>,boost::units::list<boost::units::metric::bar_base_unit,boost::units::dimensionless_type>>>
1> ]
1> c:\workspace\externals\boost_1_57_0\include\boost\units\unit.hpp(99) : see reference to class template instantiation 'boost::units::reduce_unit<S1>' being compiled
1> with
1> [
1> S1=BSII::Units::bar_per_minute_unit
1> ]
1> c:\workspace\foundations\sw_foundations\bsii_common\test\src\units\units_pressure_test.cpp(97) : see reference to class template instantiation 'boost::units::is_implicitly_convertible<BSII::Units::bar_per_minute_unit,Unit>' being compiled
1> with
1> [
1> Unit=BSII::Units::bar_per_minute_unit
1> ]
According to the Boost documentation a homogeneous system can only be composed of linearly independent base units. In my case, I'm trying to mix bars (which in turn "contain" seconds as the time element) with minutes. This sounds problematic to me. But on the other hand, since I don't include mass and length base units in my system it seems to me that the base is independent after all.
In any case, I searched online for an example of creating such a heterogeneous unit but didn't find anything comprehensible. Also, I read in the Boost documentation that a heterogeneous unit doesn't perserve information about how it was created. Does this mean I won't be able to, for instance, multiply BarPerMinuteRoC by Minute and get Bar back?

This is a bug in the library. Your code ought to work and it does in the current GIT develop branch.

Related

boost 1.73 messages reporting during project build

I'm using Boost 1.73 on a older project which was using Boost 1.48. My intention is to fix any warnings and errors along the way.
When compiling the project I'm getting some odd messages which are not in the source of the project but in boost itself, these messages are like most error messages, cryptic and not terribly helpful.
1>debugengine.cpp
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\utility(173): warning C4244: 'initializing': conversion from '_Ty' to '_Ty2', possible loss of data
1> with
1> [
1> _Ty=int
1> ]
1> and
1> [
1> _Ty2=unsigned short
1> ]
1>c:\boost\boost_1_73_0\boost\date_time\date_parsing.hpp(111): note: see reference to function template instantiation 'std::pair<const _Kty,_Ty>::pair<const char(&)[4],int,0>(_Other1,_Other2 &&) noexcept(false)' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=unsigned short,
1> _Other1=const char (&)[4],
1> _Other2=int
1> ]
1>c:\boost\boost_1_73_0\boost\date_time\date_parsing.hpp(99): note: see reference to function template instantiation 'std::pair<const _Kty,_Ty>::pair<const char(&)[4],int,0>(_Other1,_Other2 &&) noexcept(false)' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=unsigned short,
1> _Other1=const char (&)[4],
1> _Other2=int
1> ]
1>c:\boost\boost_1_73_0\boost\date_time\date_parsing.hpp(168): note: see reference to function template instantiation 'unsigned short boost::date_time::month_str_to_ushort<month_type>(const std::string &)' being compiled
1>c:\boost\boost_1_73_0\boost\date_time\gregorian\parsers.hpp(49): note: see reference to function template instantiation 'date_type boost::date_time::parse_date<boost::gregorian::date>(const std::string &,int)' being compiled
1> with
1> [
1> date_type=boost::gregorian::date
1> ]
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(54): note: see reference to class template instantiation 'boost::arg<9>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(53): note: see reference to class template instantiation 'boost::arg<8>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(52): note: see reference to class template instantiation 'boost::arg<7>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(51): note: see reference to class template instantiation 'boost::arg<6>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(50): note: see reference to class template instantiation 'boost::arg<5>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(49): note: see reference to class template instantiation 'boost::arg<4>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(48): note: see reference to class template instantiation 'boost::arg<3>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(47): note: see reference to class template instantiation 'boost::arg<2>' being compiled
1>c:\boost\boost_1_73_0\boost\bind\placeholders.hpp(46): note: see reference to class template instantiation 'boost::arg<1>' being compiled
Is there anything I can do?
I'm using MSVC 2017.
I've narrowed the problem down to just one file and commented out everything except:
#include <boost/date_time.hpp>
This is what I get when compiling just this:
1>------ Build started: Project: Debug Service Group, Configuration: Debug Win32 ------
1>debugengine.cpp
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\utility(173): warning C4244: 'initializing': conversion from '_Ty' to '_Ty2', possible loss of data
1> with
1> [
1> _Ty=int
1> ]
1> and
1> [
1> _Ty2=unsigned short
1> ]
1>c:\boost\boost_1_73_0\boost\date_time\date_parsing.hpp(111): note: see reference to function template instantiation 'std::pair<const _Kty,_Ty>::pair<const char(&)[4],int,0>(_Other1,_Other2 &&) noexcept(false)' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=unsigned short,
1> _Other1=const char (&)[4],
1> _Other2=int
1> ]
1>c:\boost\boost_1_73_0\boost\date_time\date_parsing.hpp(99): note: see reference to function template instantiation 'std::pair<const _Kty,_Ty>::pair<const char(&)[4],int,0>(_Other1,_Other2 &&) noexcept(false)' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=unsigned short,
1> _Other1=const char (&)[4],
1> _Other2=int
1> ]
1>c:\boost\boost_1_73_0\boost\date_time\date_parsing.hpp(168): note: see reference to function template instantiation 'unsigned short boost::date_time::month_str_to_ushort<month_type>(const std::string &)' being compiled
1>c:\boost\boost_1_73_0\boost\date_time\gregorian\parsers.hpp(49): note: see reference to function template instantiation 'date_type boost::date_time::parse_date<boost::gregorian::date>(const std::string &,int)' being compiled
1> with
1> [
1> date_type=boost::gregorian::date
1> ]
1>Done building project "Debug Service Group.vcxproj".
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
The warnings are harmless. Here's the source in boost\date_time\date_parsing.hpp line 99
static std::map<std::string, unsigned short> month_map =
{ { "jan", 1 }, { "january", 1 },
As you can see the value type of the map is unsigned short but it is being initialised with int values.
I'm slightly surprised at the warning, you might think that MSVC 2017 would be smart enough to realise that assigning 1 to an unsigned short is not a problem.
I don't get any warnings with MSVC 2019

`boost` `Signal2` library conflicts with Microsoft memory leak detection?

I have portable Linux/Windows application. I use boost Signal2 library to implement events system.
Microsoft has built-in memory leak detection feature in Visual C++. You have to include some code at the very beginning of any source file to replace normal malloc and new with theirs debug versions, and these debug memory management functions generate memory leak report when application exits. The code follows:
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#ifndef DBG_NEW
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW
#endif
#endif
When I include this code, the program stops to compile. Error messages are not understandable and don't even point to source file where the error occurred (they point to boost headers, but not to my program headers or code files). Error report follows:
D:\src\open-source\boost\boost/variant/detail/initializer.hpp(122): error C2061: syntax error : identifier 'dest'
1> D:\src\open-source\boost\boost/variant/detail/initializer.hpp(116) : while compiling class template member function 'int boost::detail::variant::make_initializer_node::apply<T1,T2>::initializer_node::initialize(void *,boost::shared_ptr<void> &&)'
1> with
1> [
1> T1=boost::mpl::pair<boost::detail::variant::initializer_root,boost::mpl::int_<0>>
1> , T2=boost::mpl::l_iter<boost::mpl::list2<boost::shared_ptr<void>,boost::signals2::detail::foreign_void_shared_ptr>>
1> ]
1> D:\src\open-source\boost\boost/variant/variant.hpp(1559) : see reference to function template instantiation 'int boost::detail::variant::make_initializer_node::apply<T1,T2>::initializer_node::initialize(void *,boost::shared_ptr<void> &&)' being compiled
1> with
1> [
1> T1=boost::mpl::pair<boost::detail::variant::initializer_root,boost::mpl::int_<0>>
1> , T2=boost::mpl::l_iter<boost::mpl::list2<boost::shared_ptr<void>,boost::signals2::detail::foreign_void_shared_ptr>>
1> ]
1> D:\src\open-source\boost\boost/variant/detail/initializer.hpp(76) : see reference to class template instantiation 'boost::detail::variant::make_initializer_node::apply<T1,T2>::initializer_node' being compiled
1> with
1> [
1> T1=boost::mpl::pair<boost::detail::variant::initializer_root,boost::mpl::int_<0>>
1> , T2=boost::mpl::l_iter<boost::mpl::list2<boost::shared_ptr<void>,boost::signals2::detail::foreign_void_shared_ptr>>
1> ]
1> D:\src\open-source\boost\boost/variant/variant.hpp(1339) : see reference to class template instantiation 'boost::detail::variant::make_initializer_node::apply<T1,T2>::initializer_node' being compiled
1> with
1> [
1> T1=boost::mpl::pair<boost::detail::variant::make_initializer_node::apply<boost::mpl::pair<boost::detail::variant::initializer_root,boost::mpl::int_<0>>,boost::mpl::l_iter<boost::mpl::list2<boost::shared_ptr<void>,boost::signals2::detail::foreign_void_shared_ptr>>>::initializer_node,boost::mpl::int_<1>>
1> , T2=boost::mpl::l_iter<boost::mpl::list1<boost::signals2::detail::foreign_void_shared_ptr>>
1> ]
1> D:\src\open-source\boost\boost/variant/variant.hpp(1555) : see reference to class template instantiation 'boost::variant<boost::shared_ptr<void>,boost::signals2::detail::foreign_void_shared_ptr,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_>::initializer' being compiled
1> D:\src\open-source\boost\boost/variant/variant.hpp(1732) : see reference to function template instantiation 'void boost::variant<boost::shared_ptr<void>,boost::signals2::detail::foreign_void_shared_ptr,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_>::convert_construct<boost::shared_ptr<void>>(T &&,int,boost::mpl::false_)' being compiled
1> with
1> [
1> T=boost::shared_ptr<void>
1> ]
1> D:\src\open-source\boost\boost/variant/variant.hpp(1732) : see reference to function template instantiation 'void boost::variant<boost::shared_ptr<void>,boost::signals2::detail::foreign_void_shared_ptr,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_>::convert_construct<boost::shared_ptr<void>>(T &&,int,boost::mpl::false_)' being compiled
1> with
1> [
1> T=boost::shared_ptr<void>
1> ]
1> D:\src\open-source\boost\boost/signals2/slot_base.hpp(49) : see reference to function template instantiation 'boost::variant<boost::shared_ptr<void>,boost::signals2::detail::foreign_void_shared_ptr,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_>::variant<boost::shared_ptr<void>>(T &&,void *,void *)' being compiled
1> with
1> [
1> T=boost::shared_ptr<void>
1> ]
1> D:\src\open-source\boost\boost/signals2/slot_base.hpp(49) : see reference to function template instantiation 'boost::variant<boost::shared_ptr<void>,boost::signals2::detail::foreign_void_shared_ptr,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_,boost::detail::variant::void_>::variant<boost::shared_ptr<void>>(T &&,void *,void *)' being compiled
1> with
1> [
1> T=boost::shared_ptr<void>
1> ]
Is there any workaround to use boost and still use memory leak detection on Windows?

How can I get rid of gtest compiler warning C4800 ('int' : forcing value to bool 'true' or 'false'")

I've inherited some unit test code (VS2008 c++ for a WinCE-based smart device) that uses gtest. When I compile the unit tests I get all kinds of C4800 warnings about forcing ints into bools. What's weird is that the only gtest calls in the module generating the warnings are to EXPECT_STREQ.
Is this a (minor) bug in gtest, it's doing EXPECT_STREQ in a way that confuses VS2008/WinCE?
We are using gtest version 1.6, does anyone know if version 1.7 works for WinCE?
==============
1>C:\googletest\include\gtest/internal/gtest-port.h(1031) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1> C:\googletest\include\gtest/internal/gtest-param-util.h(321) : see reference to function template instantiation 'Derived *testing::internal::CheckedDowncastToActualType<const testing::internal::ValuesInIteratorRangeGenerator<T>::Iterator,const testing::internal::ParamIteratorInterface<T>>(Base *)' being compiled
1> with
1> [
1> Derived=const testing::internal::ValuesInIteratorRangeGenerator<ParamType>::Iterator,
1> T=ParamType,
1> Base=const testing::internal::ParamIteratorInterface<bool>
1> ]
1> C:\googletest\include\gtest/internal/gtest-param-util.h(314) : while compiling class template member function 'bool testing::internal::ValuesInIteratorRangeGenerator<T>::Iterator::Equals(const testing::internal::ParamIteratorInterface<T> &) const'
1> with
1> [
1> T=ParamType
1> ]
1> C:\googletest\include\gtest/internal/gtest-param-util.h(276) : see reference to class template instantiation 'testing::internal::ValuesInIteratorRangeGenerator<T>::Iterator' being compiled
1> with
1> [
1> T=ParamType
1> ]
1> C:\googletest\include\gtest/internal/gtest-param-util.h(275) : while compiling class template member function 'testing::internal::ParamIteratorInterface<T> *testing::internal::ValuesInIteratorRangeGenerator<T>::Begin(void) const'
1> with
1> [
1> T=bool
1> ]
1> C:\googletest\include\gtest/gtest-param-test.h(314) : see reference to class template instantiation 'testing::internal::ValuesInIteratorRangeGenerator<T>' being compiled
1> with
1> [
1> T=ParamType
1> ]
1> C:\googletest\include\gtest/gtest-param-test.h(319) : see reference to function template instantiation 'testing::internal::ParamGenerator<T> testing::ValuesIn<const T*>(ForwardIterator,ForwardIterator)' being compiled
1> with
1> [
1> T=bool,
1> ForwardIterator=const bool *
1> ]
1> C:\googletest\include\gtest/internal/gtest-param-util-generated.h(99) : see reference to function template instantiation 'testing::internal::ParamGenerator<T> testing::ValuesIn<T,2>(const T (&)[2])' being compiled
1> with
1> [
1> T=bool
1> ]
1> C:\googletest\include\gtest/gtest-param-test.h(1221) : see reference to function template instantiation 'testing::internal::ValueArray2<T1,T2>::operator testing::internal::ParamGenerator<T>(void) const<bool>' being compiled
1> with
1> [
1> T1=bool,
1> T2=bool,
1> T=bool
1> ]
Warning C4800 is given when an int is put into a variable of type bool. The documentation for warning C4800 states that it is a performance warning so you probably don't have to worry about it.
If you want hide the warning you can use MSVC's #pragma warning(disable:4800) to disable the warning.
So it would look like this
#pragma warning(disable:4800) //Disable the warning
... // Code that gives warning here
#pragma warning(default:4800) //Stop suppressing the warning
You can see the documentation for #pragma warning here.

Boost bimap won't compile: Visual Studio 2010

I'm trying to use a boost::bimap to provide bi-directional mapping of some node numbers. I have been using boost unordered maps for a few other things, and have no problems using them. I'm on visual studio 2010.
However I get a ton of template errors whenever I try and use a bimap. Even cutting and pasting the code from the examples at here I get the same masses of template problems. E.g: I inserted this code, direct from the examples:
typedef boost::bimap< int, std::string > bm_type;
bm_type bm;
bm.insert( bm_type::value_type(1, "one" ) );
bm.insert( bm_type::value_type(2, "two" ) );
and I get about 750 lines of errors, starting with this:
c:\data\boost\boost_1_56_0\boost\bimap\relation\mutant_relation.hpp(94): error C2220: warning treated as error - no 'object' file generated
1> c:\data\boost\boost_1_56_0\boost\bimap\relation\mutant_relation.hpp(157) : see reference to class template instantiation 'boost::bimaps::relation::detail::relation_storage<LeftType,RightType,force_mutable>' being compiled
1> with
1> [
1> LeftType=boost::bimaps::tags::tagged<const int,boost::bimaps::relation::member_at::left>,
1> RightType=boost::bimaps::tags::tagged<const std::basic_string<char,std::char_traits<char>,std::allocator<char>>,boost::bimaps::relation::member_at::right>,
1> force_mutable=false
1> ]
and ending in
IteratorToBaseConverter=boost::bimaps::container_adaptor::support::iterator_facade_to_base<boost::bimaps::detail::map_view_iterator<boost::bimaps::relation::member_at::right,boost::bimaps::detail::bimap_core<int,std::string,boost::mpl::na,boost::mpl::na,boost::mpl::na>>,boost::bimaps::detail::const_map_view_iterator<boost::bimaps::relation::member_at::right,boost::bimaps::detail::bimap_core<int,std::string,boost::mpl::na,boost::mpl::na,boost::mpl::na>>>,
1> IteratorFromBaseConverter=boost::mpl::na,
1> ReverseIteratorFromBaseConverter=boost::mpl::na,
1> ValueToBaseConverter=boost::bimaps::relation::detail::pair_to_relation_functor<boost::bimaps::relation::member_at::right,boost::bimaps::relation::mutant_relation<boost::bimaps::tags::tagged<const int,boost::bimaps::relation::member_at::left>,boost::bimaps::tags::tagged<const std::basic_string<char,std::char_traits<char>,std::allocator<char>>,boost::bimaps::relation::member_at::right>,boost::bimaps::detail::manage_additional_parameters<boost::mpl::na,boost::mpl::na,boost::mpl::na>::case_NNN::additional_info,true>>,
1> ValueFromBaseConverter=boost::bimaps::relation::support::get_pair_functor<boost::bimaps::relation::member_at::right,boost::bimaps::relation::mutant_relation<boost::bimaps::tags::tagged<const int,boost::bimaps::relation::member_at::left>,boost::bimaps::tags::tagged<const std::basic_string<char,std::char_traits<char>,std::allocator<char>>,boost::bimaps::relation::member_at::right>,boost::bimaps::detail::manage_additional_parameters<boost::mpl::na,boost::mpl::na,boost::mpl::na>::case_NNN::additional_info,true>>
1> ]
1>c:\data\my_code.cpp(194): error C2665: 'boost::bimaps::relation::mutant_relation<TA,TB,Info,force_mutable>::mutant_relation' : none of the 5 overloads could convert all the argument types
1> with
1> [
1> TA=boost::bimaps::tags::tagged<const int,boost::bimaps::relation::member_at::left>,
1> TB=boost::bimaps::tags::tagged<const std::basic_string<char,std::char_traits<char>,std::allocator<char>>,boost::bimaps::relation::member_at::right>,
1> Info=boost::bimaps::detail::manage_additional_parameters<boost::mpl::na,boost::mpl::na,boost::mpl::na>::case_NNN::additional_info,
1> force_mutable=false
1> ]
1> c:\data\boost\boost_1_56_0\boost\bimap\relation\mutant_relation.hpp(265): could be 'boost::bimaps::relation::mutant_relation<TA,TB,Info,force_mutable>::mutant_relation(const int,const std::basic_string<_Elem,_Traits,_Ax> &)'
1> with
1> [
1> TA=boost::bimaps::tags::tagged<const int,boost::bimaps::relation::member_at::left>,
1> TB=boost::bimaps::tags::tagged<const std::basic_string<char,std::char_traits<char>,std::allocator<char>>,boost::bimaps::relation::member_at::right>,
1> Info=boost::bimaps::detail::manage_additional_parameters<boost::mpl::na,boost::mpl::na,boost::mpl::na>::case_NNN::additional_info,
1> force_mutable=false,
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> while trying to match the argument list '(int, int)'
The same code on a linux machine compiles without errors. Any help most appreciated!
As noted in the comments below, the line
boost::bimap< int, std::string > test;
on its own will trigger similar errors. Ignore the error above regarding (int, int), I had left an earlier line in the code which was using a boost::bimap. Now removed, no significant change in the volume of errors.

Multiple lookup set

I need a data structure, and I'm unsure of what to choose. Fundamentally, my need is similar to std::set, except I need to look up according to multiple different comparators over the same data at the same time.
Right now I've decided to go for some kludge- a std::map<float, std::unordered_set<T>> and then a std::unordered_map<T, std::unordered_set<T>*>. This should permit O(log N) lookup for a float and O(1) lookup/removal for a T.
Are there any better data structures to use? This has "hack" written all over it.
As an aside, this code is fairly performance critical, so something fast would be very appreciated.
Edit: I've been poking with boost::multi_index and here's what I've got so far:
boost::multi_index_container<
NodeType,
boost::multi_index::indexed_by<
boost::multi_index::ordered_non_unique<boost::multi_index::identity<NodeType>, decltype(node_comparator)>,
boost::multi_index::hashed_unique<boost::multi_index::identity<NodeType>>
>
> open_set(
boost::make_tuple(node_comparator)
);
where node_comparator is an in_scope lambda. But attempting to compile it results in some glorious errors.
1>d:\backups\code\boost_1_47_0\boost\multi_index\detail\node_type.hpp(56): error C2903: 'node_class' : symbol is neither a class template nor a function template
1> d:\backups\code\boost_1_47_0\boost\mpl\aux_\preprocessed\plain\apply_wrap.hpp(49) : see reference to class template instantiation 'boost::multi_index::detail::index_node_applier::apply<IndexSpecifierIterator,Super>' being compiled
1> with
1> [
1> IndexSpecifierIterator=boost::mpl::v_iter<boost::mpl::vector2<boost::multi_index::ordered_non_unique<boost::multi_index::identity<NodeType>,Wide::Sim::`anonymous-namespace'::<lambda8>>,boost::multi_index::hashed_unique<boost::multi_index::identity<NodeType>>>,0>,
1> Super=boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<NodeType,std::allocator<NodeType>>>
1> ]
1> d:\backups\code\boost_1_47_0\boost\mpl\aux_\preprocessed\plain\bind.hpp(207) : see reference to class template instantiation 'boost::mpl::apply_wrap2<F,T1,T2>' being compiled
1> with
1> [
1> F=boost::multi_index::detail::index_node_applier,
1> T1=boost::mpl::v_iter<boost::mpl::vector2<boost::multi_index::ordered_non_unique<boost::multi_index::identity<NodeType>,Wide::Sim::`anonymous-namespace'::<lambda8>>,boost::multi_index::hashed_unique<boost::multi_index::identity<NodeType>>>,0>,
1> T2=boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<NodeType,std::allocator<NodeType>>>
1> ]
1> d:\backups\code\boost_1_47_0\boost\mpl\aux_\preprocessed\plain\apply_wrap.hpp(49) : see reference to class template instantiation 'boost::mpl::bind2<F,T1,T2>::apply<U1,U2>' being compiled
1> with
1> [
1> F=boost::multi_index::detail::index_node_applier,
1> T1=boost::mpl::_2,
1> T2=boost::mpl::_1,
1> U1=boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<NodeType,std::allocator<NodeType>>>,
1> U2=boost::mpl::v_iter<boost::mpl::vector2<boost::multi_index::ordered_non_unique<boost::multi_index::identity<NodeType>,Wide::Sim::`anonymous-namespace'::<lambda8>>,boost::multi_index::hashed_unique<boost::multi_index::identity<NodeType>>>,0>
1> ]
1> d:\backups\code\boost_1_47_0\boost\mpl\aux_\preprocessed\plain\apply.hpp(63) : see reference to class template instantiation 'boost::mpl::apply_wrap2<F,T1,T2>' being compiled
1> with
1> [
1> F=boost::mpl::bind2<boost::multi_index::detail::index_node_applier,boost::mpl::_2,boost::mpl::_1>,
1> T1=boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<NodeType,std::allocator<NodeType>>>,
1> T2=boost::mpl::v_iter<boost::mpl::vector2<boost::multi_index::ordered_non_unique<boost::multi_index::identity<NodeType>,Wide::Sim::`anonymous-namespace'::<lambda8>>,boost::multi_index::hashed_unique<boost::multi_index::identity<NodeType>>>,0>
1> ]
1> d:\backups\code\boost_1_47_0\boost\mpl\aux_\preprocessed\plain\reverse_iter_fold_impl.hpp(82) : see reference to class template instantiation 'boost::mpl::apply2<F,T1,T2>' being compiled
1> with
1> [
1> F=boost::mpl::bind2<boost::multi_index::detail::index_node_applier,boost::mpl::_2,boost::mpl::_1>,
1> T1=boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<NodeType,std::allocator<NodeType>>>,
1> T2=boost::mpl::v_iter<boost::mpl::vector2<boost::multi_index::ordered_non_unique<boost::multi_index::identity<NodeType>,Wide::Sim::`anonymous-namespace'::<lambda8>>,boost::multi_index::hashed_unique<boost::multi_index::identity<NodeType>>>,0>
1> ]
1> d:\backups\code\boost_1_47_0\boost\mpl\reverse_iter_fold.hpp(43) : see reference to class template instantiation 'boost::mpl::aux::reverse_iter_fold_impl<N,First,Last,State,BackwardOp,ForwardOp>' being compiled
1> with
1> [
1> N=2,
1> First=boost::mpl::v_iter<boost::mpl::vector2<boost::multi_index::ordered_non_unique<boost::multi_index::identity<NodeType>,Wide::Sim::`anonymous-namespace'::<lambda8>>,boost::multi_index::hashed_unique<boost::multi_index::identity<NodeType>>>,0>,
1> Last=boost::mpl::v_iter<boost::mpl::vector2<boost::multi_index::ordered_non_unique<boost::multi_index::identity<NodeType>,Wide::Sim::`anonymous-namespace'::<lambda8>>,boost::multi_index::hashed_unique<boost::multi_index::identity<NodeType>>>,2>,
1> State=boost::multi_index::detail::index_node_base<NodeType,std::allocator<NodeType>>,
1> BackwardOp=boost::mpl::bind2<boost::multi_index::detail::index_node_applier,boost::mpl::_2,boost::mpl::_1>,
1> ForwardOp=boost::mpl::protect<boost::mpl::arg<1>>
1> ]
1> d:\backups\code\boost_1_47_0\boost\multi_index\detail\node_type.hpp(70) : see reference to class template instantiation 'boost::mpl::reverse_iter_fold<Sequence,State,BackwardOp>' being compiled
1> with
1> [
1> Sequence=boost::multi_index::indexed_by<boost::multi_index::ordered_non_unique<boost::multi_index::identity<NodeType>,Wide::Sim::`anonymous-namespace'::<lambda8>>,boost::multi_index::hashed_unique<boost::multi_index::identity<NodeType>>>,
1> State=boost::multi_index::detail::index_node_base<NodeType,std::allocator<NodeType>>,
1> BackwardOp=boost::mpl::bind2<boost::multi_index::detail::index_node_applier,boost::mpl::_2,boost::mpl::_1>
1> ]
1> d:\backups\code\boost_1_47_0\boost\multi_index_container.hpp(75) : see reference to class template instantiation 'boost::multi_index::detail::multi_index_node_type<Value,IndexSpecifierList,Allocator>' being compiled
1> with
1> [
1> Value=NodeType,
1> IndexSpecifierList=boost::multi_index::indexed_by<boost::multi_index::ordered_non_unique<boost::multi_index::identity<NodeType>,Wide::Sim::`anonymous-namespace'::<lambda8>>,boost::multi_index::hashed_unique<boost::multi_index::identity<NodeType>>>,
1> Allocator=std::allocator<NodeType>
1> ]
1> c:\repo\render\render\sim\simcontext.cpp(264) : see reference to class template instantiation 'boost::multi_index::multi_index_container<Value,IndexSpecifierList>' being compiled
1> with
1> [
1> Value=NodeType,
1> IndexSpecifierList=boost::multi_index::indexed_by<boost::multi_index::ordered_non_unique<boost::multi_index::identity<NodeType>,Wide::Sim::`anonymous-namespace'::<lambda8>>,boost::multi_index::hashed_unique<boost::multi_index::identity<NodeType>>>
1> ]
This is just the first; there are many, but I'm well aware of Visual Studio's propensity to let one error cause 9999999 more.
One thing you can try is to use a weak_ptr in your unordered_set, and shared_ptr for your elements. When you destruct the element, a NULL weak_ptr is left behind. You would need some way to garbage collect those NULL weak_ptr entries in your container, but that cost is likely easily amortized. This way, you avoid needing to use a second index at all.
multi_index was the winner. Unfortunately dirkgently posted as comment, not answer, or I'd accept it.