Boost-users
Threads by month
- ----- 2024 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1999 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1998 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1997 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- 28291 discussions
all,
I have the following:
boost::make_recursive_variant<int, bool, std::string,
std::map<std::string, boost::recursive_variant_>>::type node;
I'm populating this tree. I'm using libucl because it has a relaxed JSON
syntax but I wanted to have a tree-like configuration here. The std::map
is a key:value pair obviously. So my questions:
How do I get std::maps from this variant? I know boost::get exists, will
it just return a pointer to std::map? does setting elements in the map
set elements on the variant?
I also didn't see any return info for what boost::get returns if the
element does not exist. Will it just return null since it does return a T*?
Finally, is there a way to see the type of the variant? I don't really
care if it's a bool or string, although I would like to place some
implicit checks on certain values when they're retrieved.
PS: If there's a way to pull this off with boost::property_tree, I would
love to know how. I'm looking at using libucl as mentioned before
because it provides a nginx-like not really JSON-style configuration syntax.
Any tips would be appreciated. HOpefully these questions are clear and
make sense.
--
Take care,
Ty
Twitter: @sorressean
Web: https://tysdomain.com
Pubkey: https://tysdomain.com/files/pubkey.asc
2
1
Please bear with me as I am not really familiar with Solaris.
I have an 11.3 box, where I installed the developer studio 12.5. Following directions at https://blogs.oracle.com/studiocpp/entry/test, I tried to build boost 1.61. It fails horribly!
I get as far as:
>>
create compiler configuration for Studio 12.4 C++03 (using Boost.Config configure) so all the fancy C++11 stuff in Boost is not yet enabled even if we compile with -std=c++11.
] cd libs/config; CXX=CC CXXFLAGS="-std=c++03 -m64" LDFLAGS="-std=c++03 -m64" sh ./configure
<<
which fails. Config.log contains:
configure:1959: CC -std=c++03 -m64 -std=c++03 -m64 conftest.cpp >&5
CC: Warning: Option -std=c++03 passed to ld, if ld is invoked, ignored otherwise
CC: Warning: Option -std=c++03 passed to ld, if ld is invoked, ignored otherwise
ld: fatal: option '-d' has illegal argument '=c++03'
ld: fatal: option '-d' has illegal argument '=c++03'
Removing "-std=c++03" does allow the configure process to run but not as it was intended.
Building with: "./b2 --user-config=user-config.jam address-model=64 -j12 --disable-icu"
gives me a lot of errors, such as those below. Below my problem description, I've pasted the build errors I noticed until I broke the build. What is the proper sequence to build boost 1.61 on Solaris?
Many thanks for any help!
Build output (excerpts):
root@solaris:~/jearle/crypto/3rdpartySW/boost-build/boost_1_61_0# ./b2 --user-config=user-config.jam address-model=64 -j12 --disable-icu
Performing configuration checks
- 32-bit : yes (cached)
- arm : no (cached)
- mips1 : no (cached)
- power : no (cached)
- sparc : no (cached)
- x86 : yes (cached)
Building the Boost C++ Libraries.
- symlinks supported : yes (cached)
error: No best alternative for libs/context/build/asm/make_x86_64_sysv_elf_gas.o
next alternative: required properties: <threading>multi
matched
next alternative: required properties: <threading>multi
matched
error: No best alternative for libs/context/build/asm/jump_x86_64_sysv_elf_gas.o
next alternative: required properties: <threading>multi
matched
next alternative: required properties: <threading>multi
matched
error: No best alternative for libs/context/build/asm/ontop_x86_64_sysv_elf_gas.o
next alternative: required properties: <threading>multi
matched
next alternative: required properties: <threading>multi
matched
- C++11 mutex : no (cached)
- lockfree boost::atomic_flag : no (cached)
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam
- zlib : no (cached)
- icu : no (cached)
- icu (lib64) : no (cached)
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
- compiler-supports-visibility : no (cached)
- compiler-supports-ssse3 : yes (cached)
- has_icu builds : no (cached)
- compiler-supports-avx2 : no (cached)
- gcc visibility : no (cached)
- long double support : yes (cached)
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
error: No best alternative for libs/context/build/asm/make_x86_64_sysv_elf_gas.o
next alternative: required properties: <threading>multi
matched
next alternative: required properties: <threading>multi
matched
error: No best alternative for libs/context/build/asm/jump_x86_64_sysv_elf_gas.o
next alternative: required properties: <threading>multi
matched
next alternative: required properties: <threading>multi
matched
error: No best alternative for libs/context/build/asm/ontop_x86_64_sysv_elf_gas.o
next alternative: required properties: <threading>multi
matched
next alternative: required properties: <threading>multi
matched
- zlib : no (cached)
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
- Boost.Locale needs either iconv or ICU library to be built.
...
...patience...
...found 9011 targets...
...updating 845 targets...
sun.compile.c++ bin.v2/libs/wave/build/sun/release/address-model-64/link-static/threading-multi/instantiate_re2c_lexer.o
CC: Warning: Option -std=c++11 passed to ld, if ld is invoked, ignored otherwise
"./boost/detail/iterator.hpp", line 19: Error: iterator_traits is not a member of std.
"./boost/wave/util/flex_string.hpp", line 128: Error: Templates can only declare classes or functions.
"./boost/wave/util/flex_string.hpp", line 131: Warning: Implicit int is not supported in C++.
"./boost/wave/util/flex_string.hpp", line 131: Error: "," expected instead of "!=".
"./boost/wave/util/flex_string.hpp", line 131: Error: A declaration was expected instead of "--".
"./boost/wave/util/flex_string.hpp", line 131: Warning: Implicit int is not supported in C++.
"./boost/wave/util/flex_string.hpp", line 131: Error: Multiple declaration for n.
"./boost/wave/util/flex_string.hpp", line 131: Error: Use ";" to terminate declarations.
"./boost/wave/util/flex_string.hpp", line 131: Error: A declaration was expected instead of "++".
"./boost/wave/util/flex_string.hpp", line 131: Warning: Implicit int is not supported in C++.
"./boost/wave/util/flex_string.hpp", line 131: Error: Use ";" to terminate declarations.
"./boost/wave/util/flex_string.hpp", line 131: Error: A declaration was expected instead of "++".
"./boost/wave/util/flex_string.hpp", line 131: Warning: Implicit int is not supported in C++.
"./boost/wave/util/flex_string.hpp", line 131: Error: "," expected instead of ")".
"./boost/wave/util/flex_string.hpp", line 135: Error: A declaration was expected instead of "return".
"./boost/wave/util/flex_string.hpp", line 135: Warning: Implicit int is not supported in C++.
"./boost/wave/util/flex_string.hpp", line 2538: Error: A declaration was expected instead of "}".
"./boost/wave/util/flex_string.hpp", line 2539: Error: A declaration was expected instead of "}".
"./boost/wave/token_ids.hpp", line 359: Error: flex_string is not a member of boost::wave::util.
"./boost/wave/token_ids.hpp", line 359: Error: A declaration does not specify a tag or an identifier.
"./boost/wave/token_ids.hpp", line 359: Error: Use ";" to terminate declarations.
"./boost/wave/token_ids.hpp", line 359: Error: A declaration was expected instead of "<".
"./boost/wave/token_ids.hpp", line 359: Error: A declaration does not specify a tag or an identifier.
"./boost/wave/token_ids.hpp", line 359: Error: Use ";" to terminate declarations.
"./boost/wave/token_ids.hpp", line 359: Error: A declaration was expected instead of ",".
"./boost/wave/token_ids.hpp", line 359: Warning: declarator required in declaration.
"./boost/wave/token_ids.hpp", line 359: Error: Use ";" to terminate declarations.
"./boost/wave/token_ids.hpp", line 359: Error: A declaration was expected instead of ",".
"./boost/wave/token_ids.hpp", line 359: Warning: declarator required in declaration.
"./boost/wave/token_ids.hpp", line 359: Error: Use ";" to terminate declarations.
"./boost/wave/token_ids.hpp", line 359: Error: A declaration was expected instead of ",".
"./boost/wave/token_ids.hpp", line 359: Error: CowString is not a member of boost::wave::util.
Compilation aborted, too many Error messages.
...
"CC" -xO4 -mt -erroff=%none -std=c++11 -m64 -DBOOST_ALL_NO_LIB=1 -DBOOST_THREAD_USE_LIB=1 -DNDEBUG -I"." -c -o "bin.v2/libs/wave/build/sun/release/address-model-64/link-static/threading-multi/instantiate_re2c_lexer_str.o" "libs/wave/src/instantiate_re2c_lexer_str.cpp"
...failed sun.compile.c++ bin.v2/libs/wave/build/sun/release/address-model-64/link-static/threading-multi/instantiate_re2c_lexer_str.o...
sun.compile.c++ bin.v2/libs/wave/build/sun/release/address-model-64/link-static/threading-multi/wave_config_constant.o
CC: Warning: Option -std=c++11 passed to ld, if ld is invoked, ignored otherwise
"./boost/detail/iterator.hpp", line 19: Error: iterator_traits is not a member of std.
"./boost/wave/util/flex_string.hpp", line 128: Error: Templates can only declare classes or functions.
"./boost/wave/util/flex_string.hpp", line 131: Warning: Implicit int is not supported in C++.
"./boost/wave/util/flex_string.hpp", line 131: Error: "," expected instead of "!=".
"./boost/wave/util/flex_string.hpp", line 131: Error: A declaration was expected instead of "--".
"./boost/wave/util/flex_string.hpp", line 131: Warning: Implicit int is not supported in C++.
"./boost/wave/util/flex_string.hpp", line 131: Error: Multiple declaration for n.
"./boost/wave/util/flex_string.hpp", line 131: Error: Use ";" to terminate declarations.
"./boost/wave/util/flex_string.hpp", line 131: Error: A declaration was expected instead of "++".
"./boost/wave/util/flex_string.hpp", line 131: Warning: Implicit int is not supported in C++.
"./boost/wave/util/flex_string.hpp", line 131: Error: Use ";" to terminate declarations.
"./boost/wave/util/flex_string.hpp", line 131: Error: A declaration was expected instead of "++".
"./boost/wave/util/flex_string.hpp", line 131: Warning: Implicit int is not supported in C++.
"./boost/wave/util/flex_string.hpp", line 131: Error: "," expected instead of ")".
"./boost/wave/util/flex_string.hpp", line 135: Error: A declaration was expected instead of "return".
"./boost/wave/util/flex_string.hpp", line 135: Warning: Implicit int is not supported in C++.
"./boost/wave/util/flex_string.hpp", line 2538: Error: A declaration was expected instead of "}".
"./boost/wave/util/flex_string.hpp", line 2539: Error: A declaration was expected instead of "}".
13 Error(s) and 5 Warning(s) detected.
...
"CC" -xO4 -mt -erroff=%none -std=c++11 -m64 -DBOOST_ALL_NO_LIB=1 -DBOOST_FILESYSTEM_STATIC_LINK=1 -DBOOST_SYSTEM_STATIC_LINK=1 -DNDEBUG -I"." -c -o "bin.v2/libs/filesystem/build/sun/release/address-model-64/link-static/threading-multi/portability.o" "libs/filesystem/src/portability.cpp"
...failed sun.compile.c++ bin.v2/libs/filesystem/build/sun/release/address-model-64/link-static/threading-multi/portability.o...
sun.compile.c++ bin.v2/libs/filesystem/build/sun/release/address-model-64/link-static/threading-multi/utf8_codecvt_facet.o
CC: Warning: Option -std=c++11 passed to ld, if ld is invoked, ignored otherwise
sun.compile.c++ bin.v2/libs/filesystem/build/sun/release/address-model-64/link-static/threading-multi/path.o
CC: Warning: Option -std=c++11 passed to ld, if ld is invoked, ignored otherwise
"./boost/detail/iterator.hpp", line 19: Error: iterator_traits is not a member of std.
1 Error(s) detected.
...
"CC" -xO4 -mt -erroff=%none -std=c++11 -m64 -DBOOST_ALL_NO_LIB=1 -DBOOST_IOSTREAMS_USE_DEPRECATED -DNDEBUG -I"." -c -o "bin.v2/libs/iostreams/build/sun/release/address-model-64/link-static/threading-multi/bzip2.o" "libs/iostreams/src/bzip2.cpp"
...failed sun.compile.c++ bin.v2/libs/iostreams/build/sun/release/address-model-64/link-static/threading-multi/bzip2.o...
...skipped <pbin.v2/libs/iostreams/build/sun/release/address-model-64/link-static/threading-multi>libboost_iostreams.a for lack of <pbin.v2/libs/iostreams/build/sun/release/address-model-64/link-static/threading-multi>mapped_file.o...
...skipped <pstage/lib>libboost_iostreams.a for lack of <pbin.v2/libs/iostreams/build/sun/release/address-model-64/link-static/threading-multi>libboost_iostreams.a...
sun.compile.c++ bin.v2/libs/log/build/sun/release/address-model-64/build-no/link-static/log-api-unix/threading-multi/named_scope.o
CC: Warning: Option -std=c++11 passed to ld, if ld is invoked, ignored otherwise
"./boost/log/utility/string_literal.hpp", line 76: Error: Too few arguments for template std::reverse_iterator<std::_Iterator, std::_Category, std::_Tt, std::_Reference, std::_Pointer, std::_Distance>.
"./boost/log/attributes/named_scope.hpp", line 82: Where: While specializing "boost::log::v2s_mt_posix::basic_string_literal<char, std::char_traits<char>>".
"./boost/log/attributes/named_scope.hpp", line 82: Where: Specialized in non-template code.
"./boost/log/attributes/named_scope.hpp", line 219: Error: Too few arguments for template std::reverse_iterator<std::_Iterator, std::_Category, std::_Tt, std::_Reference, std::_Pointer, std::_Distance>.
"./boost/log/attributes/named_scope.hpp", line 220: Error: Too few arguments for template std::reverse_iterator<std::_Iterator, std::_Category, std::_Tt, std::_Reference, std::_Pointer, std::_Distance>.
"./boost/log/attributes/named_scope.hpp", line 295: Error: Cannot cast from boost::log::v2s_mt_posix::attributes::named_scope_list::iter<1> to int.
"./boost/log/attributes/named_scope.hpp", line 299: Error: Cannot cast from boost::log::v2s_mt_posix::attributes::named_scope_list::iter<1> to int.
"./boost/log/attributes/named_scope.hpp", line 318: Error: The operation "* int" is illegal.
"libs/log/src/named_scope.cpp", line 213: Error: Cannot use void* to initialize boost::log::v2s_mt_posix::attributes::named_scope_entry*.
"libs/log/src/named_scope.cpp", line 217: Error: construct is not a member of std::allocator<boost::log::v2s_mt_posix::attributes::named_scope_entry>.
"libs/log/src/named_scope.cpp", line 235: Error: destroy is not a member of std::allocator<boost::log::v2s_mt_posix::attributes::named_scope_entry>.
9 Error(s) detected.
...
"CC" -xO4 -mt -erroff=%none -std=c++11 -m64 -DBOOST_ALL_NO_LIB=1 -DBOOST_DATE_TIME_STATIC_LINK -DDATE_TIME_INLINE -DNDEBUG -I"." -c -o "bin.v2/libs/date_time/build/sun/release/address-model-64/link-static/threading-multi/gregorian/greg_month.o" "libs/date_time/src/gregorian/greg_month.cpp"
...failed sun.compile.c++ bin.v2/libs/date_time/build/sun/release/address-model-64/link-static/threading-multi/gregorian/greg_month.o...
...skipped <pbin.v2/libs/date_time/build/sun/release/address-model-64/link-static/threading-multi>libboost_date_time.a for lack of <pbin.v2/libs/date_time/build/sun/release/address-model-64/link-static/threading-multi>gregorian/greg_month.o...
...skipped <pstage/lib>libboost_date_time.a for lack of <pbin.v2/libs/date_time/build/sun/release/address-model-64/link-static/threading-multi>libboost_date_time.a...
sun.compile.c++ bin.v2/libs/log/build/sun/release/address-model-64/build-no/link-static/log-api-unix/threading-multi/thread_id.o
CC: Warning: Option -std=c++11 passed to ld, if ld is invoked, ignored otherwise
"libs/log/src/thread_id.cpp", line 213: Warning (Anachronism): Formal argument 2 of type extern "C" void(*)(void*) in call to pthread_key_create(unsigned*, extern "C" void(*)(void*)) is being passed void(*)(void*).
1 Warning(s) detected.
sun.compile.c++ bin.v2/libs/log/build/sun/release/address-model-64/build-no/link-static/log-api-unix/threading-multi/severity_level.o
CC: Warning: Option -std=c++11 passed to ld, if ld is invoked, ignored otherwise
"./boost/move/unique_ptr.hpp", line 434: Error: typenamebmupd is not defined.
"libs/log/src/severity_level.cpp", line 66: Where: While instantiating "boost::movelib::unique_ptr<unsigned long, boost::movelib::default_delete<unsigned long>>::unique_ptr<unsigned long*>(unsigned long*, boost::move_upmu::nat*)".
"libs/log/src/severity_level.cpp", line 66: Where: Instantiated from non-template code.
"./boost/move/unique_ptr.hpp", line 434: Error: get_element_type is not defined.
"libs/log/src/severity_level.cpp", line 66: Where: While instantiating "boost::movelib::unique_ptr<unsigned long, boost::movelib::default_delete<unsigned long>>::unique_ptr<unsigned long*>(unsigned long*, boost::move_upmu::nat*)".
"libs/log/src/severity_level.cpp", line 66: Where: Instantiated from non-template code.
"./boost/move/unique_ptr.hpp", line 434: Error: "," expected instead of "<".
"libs/log/src/severity_level.cpp", line 66: Where: While instantiating "boost::movelib::unique_ptr<unsigned long, boost::movelib::default_delete<unsigned long>>::unique_ptr<unsigned long*>(unsigned long*, boost::move_upmu::nat*)".
"libs/log/src/severity_level.cpp", line 66: Where: Instantiated from non-template code.
"./boost/move/unique_ptr.hpp", line 434: Error: Illegal value for template parameter.
"libs/log/src/severity_level.cpp", line 66: Where: While instantiating "boost::movelib::unique_ptr<unsigned long, boost::movelib::default_delete<unsigned long>>::unique_ptr<unsigned long*>(unsigned long*, boost::move_upmu::nat*)".
"libs/log/src/severity_level.cpp", line 66: Where: Instantiated from non-template code.
"./boost/move/unique_ptr.hpp", line 434: Error: Template template-parameter boost::move_upmu::U requires a class template argument.
"libs/log/src/severity_level.cpp", line 66: Where: While instantiating "boost::movelib::unique_ptr<unsigned long, boost::movelib::default_delete<unsigned long>>::unique_ptr<unsigned long*>(unsigned long*, boost::move_upmu::nat*)".
"libs/log/src/severity_level.cpp", line 66: Where: Instantiated from non-template code.
"./boost/move/unique_ptr.hpp", line 434: Error: type is not a member of boost::move_upmu::missing_virtual_destructor<boost::movelib::default_delete<unsigned long>, int>.
"libs/log/src/severity_level.cpp", line 66: Where: While instantiating "boost::movelib::unique_ptr<unsigned long, boost::movelib::default_delete<unsigned long>>::unique_ptr<unsigned long*>(unsigned long*, boost::move_upmu::nat*)".
"libs/log/src/severity_level.cpp", line 66: Where: Instantiated from non-template code.
"./boost/move/unique_ptr.hpp", line 434: Error: value is not defined.
"libs/log/src/severity_level.cpp", line 66: Where: While instantiating "boost::movelib::unique_ptr<unsigned long, boost::movelib::default_delete<unsigned long>>::unique_ptr<unsigned long*>(unsigned long*, boost::move_upmu::nat*)".
"libs/log/src/severity_level.cpp", line 66: Where: Instantiated from non-template code.
7 Error(s) detected.
...
...failed sun.compile.c++ bin.v2/libs/log/build/sun/release/address-model-64/build-no/link-static/log-api-unix/threading-multi/syslog_backend.o...
sun.compile.c++ bin.v2/libs/log/build/sun/release/address-model-64/link-static/log-api-unix/threading-multi/dump_ssse3.o
CC: Warning: Option -std=c++11 passed to ld, if ld is invoked, ignored otherwise
"libs/log/src/dump_ssse3.cpp", line 179: ube: error: _mm_lddqu_si128 intrinsic requires at least -xarch=sse3.
CC: ube failed for libs/log/src/dump_ssse3.cpp
"CC" -xO4 -mt -erroff=%none -std=c++11 -m64 -DBOOST_ALL_NO_LIB=1 -DBOOST_ATOMIC_STATIC_LINK=1 -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_FILESYSTEM_STATIC_LINK=1 -DBOOST_LOG_BUILDING_THE_LIB=1 -DBOOST_LOG_USE_NATIVE_SYSLOG -DBOOST_LOG_WITHOUT_EVENT_LOG -DBOOST_SPIRIT_USE_PHOENIX_V3=1 -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_DONT_USE_CHRONO=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB=1 -DDATE_TIME_INLINE -DNDEBUG -D_XOPEN_SOURCE=500 -D__EXTENSIONS__ -D__STDC_CONSTANT_MACROS -D__typeof__=__typeof__ -I"." -c -o "bin.v2/libs/log/build/sun/release/address-model-64/link-static/log-api-unix/threading-multi/dump_ssse3.o" "libs/log/src/dump_ssse3.cpp"
2
1
Hi,
When I try to create a object of this,
typedef boost::multi_index_container<
ClassX*, //mapped value
boost::multi_index::indexed_by< //list of indices
boost::multi_index::hashed_unique<
boost::multi_index::const_mem_fun<ParentClassOfX, Key1,
&ParentClassOfX::getKey1> //hashed index by unique Key1
>,
boost::multi_index::hashed_unique<
boost::multi_index::const_mem_fun<ParentClassOfX, Vs64,
&ParentClassOfX::getKey2> //hashed index by unique Key1
>
>
>ClassXMultiKeyIndexed;
like,
ClassXMultiKeyIndexed sample;
and insert a pointer like this,
ClassX *a;
ClassXMultiKeyIndexed sample;
//a is not NULL and is filled up before the below insert
sample.insert(a);
This is the compilation error, it compiles fine if "sample.insert(a)" is
commented out.
Compilation error :
Compiling...
stm_container_manager_abc.cpp
c:\code\common\lib\boost\boost\detail\allocator_utilities.hpp(153) : error
C2061: syntax error : identifier 'p'
c:\code\common\lib\boost\boost\multi_index\detail\index_base.hpp(105) : see
reference to function template instantiation 'void
boost::detail::allocator::construct<Container*>(void *,const Type &)' being
compiled
with
[
Type=Container *
]
c:\code\common\lib\boost\boost\multi_index\detail\index_base.hpp(102) :
while compiling class template member function
'boost::multi_index::detail::hashed_index_node<Super,Category>
*boost::multi_index::detail::index_base<Value,IndexSpecifierList,Allocator>::insert_(Container
*const &,boost::multi_index::detail::hashed_index_node<Super,Category>
*&,boost::multi_index::detail::lvalue_tag)'
with
[
Super=boost::multi_index::detail::hashed_index_node<boost::multi_index::detail::index_node_base<Container
*,std::allocator<Container
*>>,boost::multi_index::detail::hashed_unique_tag>,
Category=boost::multi_index::detail::hashed_unique_tag,
Value=Container *,
IndexSpecifierList=boost::multi_index::indexed_by<boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<DBObject,Key1,DBObject::getKey1>>,boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<DBObject,Vs64,DBObject::getKey2>>>,
Allocator=std::allocator<Container *>
]
c:\code\common\lib\boost\boost\multi_index\hashed_index.hpp(93) :
see reference to class template instantiation
'boost::multi_index::detail::index_base<Value,IndexSpecifierList,Allocator>'
being compiled
with
[
Value=Container *,
IndexSpecifierList=boost::multi_index::indexed_by<boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<DBObject,Key1,DBObject::getKey1>>,boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<DBObject,Vs64,DBObject::getKey2>>>,
Allocator=std::allocator<Container *>
]
c:\code\common\lib\boost\boost\multi_index\hashed_index.hpp(93) :
see reference to class template instantiation
'boost::multi_index::detail::hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>'
being compiled
with
[
KeyFromValue=boost::multi_index::const_mem_fun<DBObject,Vs64,DBObject::getKey2>,
Hash=boost::hash<boost::long_long_type>,
Pred=std::equal_to<__int64>,
SuperMeta=boost::multi_index::detail::nth_layer<2,Container
*,boost::multi_index::indexed_by<boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<DBObject,Key1,DBObject::getKey1>>,boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<DBObject,Vs64,DBObject::getKey2>>>,std::allocator<Container
*>>,
TagList=boost::mpl::vector0<boost::mpl::na>,
Category=boost::multi_index::detail::hashed_unique_tag
]
c:\code\common\lib\boost\boost\multi_index_container.hpp(100) : see
reference to class template instantiation
'boost::multi_index::detail::hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>'
being compiled
with
[
KeyFromValue=boost::multi_index::const_mem_fun<DBObject,Key1,DBObject::getKey1>,
Hash=boost::hash<boost::long_long_type>,
Pred=std::equal_to<__int64>,
SuperMeta=boost::multi_index::detail::nth_layer<1,Container
*,boost::multi_index::indexed_by<boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<DBObject,Key1,DBObject::getKey1>>,boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<DBObject,Vs64,DBObject::getKey2>>>,std::allocator<Container
*>>,
TagList=boost::mpl::vector0<boost::mpl::na>,
Category=boost::multi_index::detail::hashed_unique_tag
]
c:\code\common\src\biz\model\stm-stow_model\stm_container_manager_abc.h(323)
: see reference to class template instantiation
'boost::multi_index::multi_index_container<Value,IndexSpecifierList>' being
compiled
with
[
Value=Container *,
IndexSpecifierList=boost::multi_index::indexed_by<boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<DBObject,Key1,DBObject::getKey1>>,boost::multi_index::hashed_unique<boost::multi_index::const_mem_fun<DBObject,Vs64,DBObject::getKey2>>>
]
Build log was saved at "file://c:\code\win\Debug\obj\BuildLog.htm"
ProjABC - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
4
26
Hi,
I could narrow the place where boost errors appears. Using VS2010 (with 'show includes') on a Win7 machine. Boost is installed in C:\utilitaires\boost\boost15\boost_1_50_0\boost and this directory name has been replaced by - underneath (so it's version 1.50 !)
When I write
#pragma message (" avant boost/date_time/local_time/local_time.hpp")
#include "boost/date_time/local_time/local_time.hpp"
I get all these error messages :
avant boost/date_time/local_time/local_time.hpp
--/mpl/list/aux_/preprocessed/plain/list20.hpp(157): error C2143: syntax error : missing ',' before 'string'
--/mpl/list/aux_/preprocessed/plain/list20.hpp(163): error C2974: 'boost::mpl::list19' : invalid template argument for 'T18', type expected
--/mpl/list/aux_/preprocessed/plain/list20.hpp(144) : see declaration of 'boost::mpl::list19'
--/mpl/list/aux_/preprocessed/plain/list20.hpp(167) : see reference to class template instantiation 'boost::mpl::list20<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,__formal>' being compiled
--/mpl/list/aux_/preprocessed/plain/list20.hpp(164): error C3203: 'list19' : unspecialized class template can't be used as a template argument for template parameter 'Next', expected a real type
--/mpl/list/aux_/preprocessed/plain/list20.hpp(164): error C2955: 'boost::mpl::list19' : use of class template requires template argument list
--/mpl/list/aux_/preprocessed/plain/list20.hpp(144) : see declaration of 'boost::mpl::list19'
--/mpl/list/aux_/preprocessed/plain/list20.hpp(165): error C2955: 'boost::mpl::l_item' : use of class template requires template argument list
--/mpl/list/aux_/item.hpp(30) : see declaration of 'boost::mpl::l_item'
--/mpl/aux_/preprocessed/plain/list.hpp(20): error C2143: syntax error : missing ',' before 'string'
--/mpl/aux_/preprocessed/plain/list.hpp(14): error C3747: missing default template parameter : parameter 20
--/mpl/aux_/preprocessed/plain/list.hpp(31): error C2975: 'boost::mpl::list' : invalid template argument for 'unnamed-parameter', expected compile-time constant expression
--/mpl/aux_/preprocessed/plain/list.hpp(22) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(34): error C2913: explicit specialization; 'boost::mpl::list' is not a specialization of a class template
--/mpl/aux_/preprocessed/plain/list.hpp(46): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(43) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(58): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(55) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(70): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(67) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(82): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(79) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(94): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(91) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(107): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(104) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(120): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(117) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(133): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(130) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(146): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(143) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(159): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(156) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(173): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(170) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(187): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(184) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(201): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(198) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(215): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(212) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(231): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(226) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(249): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(243) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(267): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(261) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(285): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(279) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(303): error C2976: 'boost::mpl::list' : too few template arguments
--/mpl/aux_/preprocessed/plain/list.hpp(297) : see declaration of 'boost::mpl::list'
--/mpl/aux_/preprocessed/plain/list.hpp(311): error C2143: syntax error : missing ',' before 'string'
--/mpl/vector/aux_/preprocessed/plain/vector20.hpp(1020): error C2143: syntax error : missing ',' before 'string'
--/mpl/vector/aux_/preprocessed/plain/vector20.hpp(1045): error C2059: syntax error : 'string'
--/mpl/vector/aux_/preprocessed/plain/vector20.hpp(1052) : see reference to class template instantiation 'boost::mpl::vector20<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,__formal>' being compiled
--/mpl/vector/aux_/preprocessed/plain/vector20.hpp(1045): error C2238: unexpected token(s) preceding ';'
--/mpl/vector/aux_/preprocessed/plain/vector20.hpp(1049): error C2059: syntax error : 'string'
--/mpl/vector/aux_/preprocessed/plain/vector20.hpp(1049): error C2238: unexpected token(s) preceding ';'
--/mpl/vector/aux_/preprocessed/plain/vector20.hpp(1072): error C2975: 'boost::mpl::vector20' : invalid template argument for 'unnamed-parameter', expected compile-time constant expression
--/mpl/vector/aux_/preprocessed/plain/vector20.hpp(1023) : see declaration of 'boost::mpl::vector20'
--/mpl/vector/aux_/preprocessed/plain/vector20.hpp(1073) : see reference to class template instantiation 'boost::mpl::push_front_impl<boost::mpl::aux::vector_tag<N>>::apply<Vector,T>' being compiled
with
[
N=19
]
--/mpl/vector/aux_/preprocessed/plain/vector20.hpp(1114): error C2975: 'boost::mpl::vector20' : invalid template argument for 'unnamed-parameter', expected compile-time constant expression
--/mpl/vector/aux_/preprocessed/plain/vector20.hpp(1023) : see declaration of 'boost::mpl::vector20'
--/mpl/vector/aux_/preprocessed/plain/vector20.hpp(1115) : see reference to class template instantiation 'boost::mpl::push_back_impl<boost::mpl::aux::vector_tag<N>>::apply<Vector,T>' being compiled
with
[
N=19
]
--/mpl/aux_/preprocessed/plain/vector.hpp(20): error C2143: syntax error : missing ',' before 'string'
--/mpl/aux_/preprocessed/plain/vector.hpp(14): error C3747: missing default template parameter : parameter 20
--/mpl/aux_/preprocessed/plain/vector.hpp(31): error C2975: 'boost::mpl::vector' : invalid template argument for 'unnamed-parameter', expected compile-time constant expression
--/mpl/aux_/preprocessed/plain/vector.hpp(22) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(34): error C2913: explicit specialization; 'boost::mpl::vector' is not a specialization of a class template
--/mpl/aux_/preprocessed/plain/vector.hpp(46): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(43) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(58): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(55) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(70): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(67) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(82): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(79) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(94): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(91) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(107): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(104) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(120): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(117) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(133): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(130) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(146): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(143) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(159): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(156) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(173): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(170) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(187): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(184) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(201): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(198) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(215): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(212) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(231): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(226) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(249): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(243) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(267): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(261) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(285): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(279) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(303): error C2976: 'boost::mpl::vector' : too few template arguments
--/mpl/aux_/preprocessed/plain/vector.hpp(297) : see declaration of 'boost::mpl::vector'
--/mpl/aux_/preprocessed/plain/vector.hpp(311): error C2143: syntax error : missing ',' before 'string'
--/math/policies/policy.hpp(406): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(440) : see reference to class template instantiation 'boost::math::policies::policy<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13>' being compiled
--/math/policies/policy.hpp(406): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(407): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(407): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(408): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(408): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(409): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(409): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(410): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(410): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(411): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(411): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(412): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(412): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(413): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(413): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(418): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(418): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(419): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(419): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(425): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(425): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(426): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(426): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(430): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(430): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(434): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(434): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(438): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(438): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(439): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(439): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(514): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(588) : see reference to class template instantiation 'boost::math::policies::normalise<Policy,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13>' being compiled
--/math/policies/policy.hpp(514): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(515): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(515): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(516): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(516): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(517): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(517): error C2955: 'boost::mpl::list' : use of class template requires template argument list
--/mpl/aux_/preprocessed/plain/list.hpp(314) : see declaration of 'boost::mpl::list'
--/math/policies/policy.hpp(518): error C3203: 'list' : unspecialized class template can't be used as a template argument for template parameter 'Seq', expected a real type
--/math/policies/policy.hpp(518): fatal error C1003: error count exceeds 100; stopping compilation
What have I done wrong ?
TIA
Jean
2
1
28 Sep '16
Hi,
I am trying to use lexical_cast to convert from strings to qvm vectors, but
I keep getting an ambiguous operator>> error. I have overloaded the >>
operator for istreams and that seems to be working fine when I use it to
read from a istringstream. In a lexical_cast, though, I get the "ambiguous
overload for operator>>" error. I have tried declaring my operator>>
overload inside the std and boost::qvm namespaces to check if it was
something related to ADL, but I keep getting the same error. The thing is
the other candidates do not seem to make a lot of sense to me. Could
somebody please tell me what I am doing wrong?
Thanks in advance,
Enrique Garcia
This is a minimal example (I am building gcc/boost from the last versions
on their repositories):
#include <iostream>
#include <boost/qvm/vec.hpp>
#include <boost/lexical_cast.hpp>
std::ostream& operator<<(std::ostream& out, boost::qvm::vec<float, 3>
const& v)
{
out << "(" << v.a[0] << "," << v.a[1] << "," << v.a[2] << ")";
}
std::istream& operator>>(std::istream& in, boost::qvm::vec<float, 3>& v)
{
char c;
return in >> c >> v.a[0] >> c >> v.a[1] >> c >> v.a[2] >> c;
}
int main()
{
boost::qvm::vec<float, 3> vect { 1.0f, 2.0f, 3.0f };
std::cout << vect << std::endl;
// This code works just fine. (4.0,5.0,6.0) is printed
std::istringstream istream("(4.0,5.0,6.0");
istream >> vect;
std::cout << vect << std::endl;
// This code generates an ambiguous overload for operator>> error (see
below)
vect = boost::lexical_cast<boost::qvm::vec<float, 3>>("(1.0,2.0,3.0)");
std::cout << vect << std::endl;
return 0;
}
This is the error I am getting from gcc:
In file included from /usr/local/include/boost/config.hpp:61:0,
from /usr/local/include/boost/static_assert.hpp:17,
from /usr/local/include/boost/qvm/static_assert.hpp:7,
from /usr/local/include/boost/qvm/vec.hpp:11,
from /home/kique/Documents/Bitflow2x/source/main.cpp:57:
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp: In
instantiation of 'const bool
boost::detail::has_right_shift_impl::operator_exists<std::basic_istream<char>,
boost::qvm::vec<float, 3> >::value':
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:179:4:
required from 'const bool
boost::detail::has_right_shift_impl::trait_impl1<std::basic_istream<char>,
boost::qvm::vec<float, 3>, boost::detail::has_right_shift_impl::dont_care,
false>::value'
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:208:4:
required from 'const bool
boost::detail::has_right_shift_impl::trait_impl<std::basic_istream<char>,
boost::qvm::vec<float, 3>,
boost::detail::has_right_shift_impl::dont_care>::value'
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:216:8:
required from 'struct boost::has_right_shift<std::basic_istream<char>,
boost::qvm::vec<float, 3>, boost::detail::has_right_shift_impl::dont_care>'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:241:21:
required from 'struct
boost::detail::deduce_target_char_impl<boost::detail::deduce_character_type_later<boost::qvm::vec<float,
3> > >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:270:89:
required from 'struct
boost::detail::deduce_target_char<boost::qvm::vec<float, 3> >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:407:92:
required from 'struct boost::detail::lexical_cast_stream_traits<const
char*, boost::qvm::vec<float, 3> >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:468:15:
required from 'struct
boost::detail::lexical_converter_impl<boost::qvm::vec<float, 3>, const
char*>'
/usr/local/include/boost/lexical_cast/try_lexical_convert.hpp:196:44:
required from 'bool boost::conversion::detail::try_lexical_convert(const
Source&, Target&) [with Target = boost::qvm::vec<float, 3>; Source = char
[14]]'
/usr/local/include/boost/lexical_cast.hpp:41:60: required from 'Target
boost::lexical_cast(const Source&) [with Target = boost::qvm::vec<float,
3>; Source = char [14]]'
/home/kique/Documents/Bitflow2x/source/main.cpp:83:72: required from here
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:158:70:
error: ambiguous overload for 'operator>>' (operand types are
'std::basic_istream<char>' and 'boost::qvm::vec<float, 3>')
BOOST_STATIC_CONSTANT(bool, value = (sizeof(s_check(((make<Lhs>()
BOOST_TT_TRAIT_OP
make<Rhs>()),make<has_operator>())))==sizeof(::boost::type_traits::yes_type)));
^
In file included from /usr/local/include/c++/7.0.0/iostream:40:0,
from /home/kique/Documents/Bitflow2x/source/main.cpp:56:
/usr/local/include/c++/7.0.0/istream:120:7: note: candidate:
std::basic_istream<_CharT, _Traits>::__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT,
_Traits>::__istream_type& (*)(std::basic_istream<_CharT,
_Traits>::__istream_type&)) [with _CharT = char; _Traits =
std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type
= std::basic_istream<char>]
operator>>(__istream_type& (*__pf)(__istream_type&))
^~~~~~~~
/usr/local/include/c++/7.0.0/istream:124:7: note: candidate:
std::basic_istream<_CharT, _Traits>::__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT,
_Traits>::__ios_type& (*)(std::basic_istream<_CharT,
_Traits>::__ios_type&)) [with _CharT = char; _Traits =
std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type
= std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__ios_type
= std::basic_ios<char>]
operator>>(__ios_type& (*__pf)(__ios_type&))
^~~~~~~~
/usr/local/include/c++/7.0.0/istream:131:7: note: candidate:
std::basic_istream<_CharT, _Traits>::__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base&
(*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>;
std::basic_istream<_CharT, _Traits>::__istream_type =
std::basic_istream<char>]
operator>>(ios_base& (*__pf)(ios_base&))
^~~~~~~~
/usr/local/include/c++/7.0.0/istream:259:7: note: candidate:
std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
_Traits>::operator>>(std::basic_istream<_CharT,
_Traits>::__streambuf_type*) [with _CharT = char; _Traits =
std::char_traits<char>; std::basic_istream<_CharT,
_Traits>::__streambuf_type = std::basic_streambuf<char>]
operator>>(__streambuf_type* __sb);
^~~~~~~~
In file included from
/usr/local/include/boost/type_traits/has_right_shift.hpp:43:0,
from /usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:39,
from /usr/local/include/boost/lexical_cast/try_lexical_convert.hpp:42,
from /usr/local/include/boost/lexical_cast.hpp:32,
from /home/kique/Documents/Bitflow2x/source/main.cpp:58:
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:70:13:
note: candidate: boost::detail::has_right_shift_impl::no_operator
boost::detail::has_right_shift_impl::operator>>(const
boost::detail::has_right_shift_impl::any&, const
boost::detail::has_right_shift_impl::any&)
no_operator operator BOOST_TT_TRAIT_OP (const any&, const any&);
^~~~~~~~
In file included from /usr/local/include/c++/7.0.0/iostream:40:0,
from /home/kique/Documents/Bitflow2x/source/main.cpp:56:
/usr/local/include/c++/7.0.0/istream:808:5: note: candidate:
std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char,
_Traits>&, signed char*) [with _Traits = std::char_traits<char>]
operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
^~~~~~~~
/usr/local/include/c++/7.0.0/istream:803:5: note: candidate:
std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char,
_Traits>&, unsigned char*) [with _Traits = std::char_traits<char>]
operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
^~~~~~~~
In file included from /usr/local/include/boost/config.hpp:61:0,
from /usr/local/include/boost/static_assert.hpp:17,
from /usr/local/include/boost/qvm/static_assert.hpp:7,
from /usr/local/include/boost/qvm/vec.hpp:11,
from /home/kique/Documents/Bitflow2x/source/main.cpp:57:
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp: In
instantiation of 'const bool
boost::detail::has_right_shift_impl::operator_returns_void<std::basic_istream<char>,
boost::qvm::vec<float, 3> >::value':
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:179:4:
required from 'const bool
boost::detail::has_right_shift_impl::trait_impl1<std::basic_istream<char>,
boost::qvm::vec<float, 3>, boost::detail::has_right_shift_impl::dont_care,
false>::value'
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:208:4:
required from 'const bool
boost::detail::has_right_shift_impl::trait_impl<std::basic_istream<char>,
boost::qvm::vec<float, 3>,
boost::detail::has_right_shift_impl::dont_care>::value'
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:216:8:
required from 'struct boost::has_right_shift<std::basic_istream<char>,
boost::qvm::vec<float, 3>, boost::detail::has_right_shift_impl::dont_care>'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:241:21:
required from 'struct
boost::detail::deduce_target_char_impl<boost::detail::deduce_character_type_later<boost::qvm::vec<float,
3> > >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:270:89:
required from 'struct
boost::detail::deduce_target_char<boost::qvm::vec<float, 3> >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:407:92:
required from 'struct boost::detail::lexical_cast_stream_traits<const
char*, boost::qvm::vec<float, 3> >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:468:15:
required from 'struct
boost::detail::lexical_converter_impl<boost::qvm::vec<float, 3>, const
char*>'
/usr/local/include/boost/lexical_cast/try_lexical_convert.hpp:196:44:
required from 'bool boost::conversion::detail::try_lexical_convert(const
Source&, Target&) [with Target = boost::qvm::vec<float, 3>; Source = char
[14]]'
/usr/local/include/boost/lexical_cast.hpp:41:60: required from 'Target
boost::lexical_cast(const Source&) [with Target = boost::qvm::vec<float,
3>; Source = char [14]]'
/home/kique/Documents/Bitflow2x/source/main.cpp:83:72: required from here
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:95:114:
error: ambiguous overload for 'operator>>' (operand types are
'std::basic_istream<char>' and 'boost::qvm::vec<float, 3>')
BOOST_STATIC_CONSTANT(bool, value =
(sizeof(::boost::type_traits::yes_type)==sizeof(returns_void((make<Lhs>()
BOOST_TT_TRAIT_OP make<Rhs>(),returns_void_t())))));
^
In file included from /usr/local/include/c++/7.0.0/iostream:40:0,
from /home/kique/Documents/Bitflow2x/source/main.cpp:56:
/usr/local/include/c++/7.0.0/istream:120:7: note: candidate:
std::basic_istream<_CharT, _Traits>::__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT,
_Traits>::__istream_type& (*)(std::basic_istream<_CharT,
_Traits>::__istream_type&)) [with _CharT = char; _Traits =
std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type
= std::basic_istream<char>]
operator>>(__istream_type& (*__pf)(__istream_type&))
^~~~~~~~
/usr/local/include/c++/7.0.0/istream:124:7: note: candidate:
std::basic_istream<_CharT, _Traits>::__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT,
_Traits>::__ios_type& (*)(std::basic_istream<_CharT,
_Traits>::__ios_type&)) [with _CharT = char; _Traits =
std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type
= std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__ios_type
= std::basic_ios<char>]
operator>>(__ios_type& (*__pf)(__ios_type&))
^~~~~~~~
/usr/local/include/c++/7.0.0/istream:131:7: note: candidate:
std::basic_istream<_CharT, _Traits>::__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base&
(*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>;
std::basic_istream<_CharT, _Traits>::__istream_type =
std::basic_istream<char>]
operator>>(ios_base& (*__pf)(ios_base&))
^~~~~~~~
/usr/local/include/c++/7.0.0/istream:259:7: note: candidate:
std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
_Traits>::operator>>(std::basic_istream<_CharT,
_Traits>::__streambuf_type*) [with _CharT = char; _Traits =
std::char_traits<char>; std::basic_istream<_CharT,
_Traits>::__streambuf_type = std::basic_streambuf<char>]
operator>>(__streambuf_type* __sb);
^~~~~~~~
In file included from
/usr/local/include/boost/type_traits/has_right_shift.hpp:43:0,
from /usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:39,
from /usr/local/include/boost/lexical_cast/try_lexical_convert.hpp:42,
from /usr/local/include/boost/lexical_cast.hpp:32,
from /home/kique/Documents/Bitflow2x/source/main.cpp:58:
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:70:13:
note: candidate: boost::detail::has_right_shift_impl::no_operator
boost::detail::has_right_shift_impl::operator>>(const
boost::detail::has_right_shift_impl::any&, const
boost::detail::has_right_shift_impl::any&)
no_operator operator BOOST_TT_TRAIT_OP (const any&, const any&);
^~~~~~~~
In file included from /usr/local/include/c++/7.0.0/iostream:40:0,
from /home/kique/Documents/Bitflow2x/source/main.cpp:56:
/usr/local/include/c++/7.0.0/istream:808:5: note: candidate:
std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char,
_Traits>&, signed char*) [with _Traits = std::char_traits<char>]
operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
^~~~~~~~
/usr/local/include/c++/7.0.0/istream:803:5: note: candidate:
std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char,
_Traits>&, unsigned char*) [with _Traits = std::char_traits<char>]
operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
^~~~~~~~
In file included from
/usr/local/include/boost/lexical_cast/try_lexical_convert.hpp:42:0,
from /usr/local/include/boost/lexical_cast.hpp:32,
from /home/kique/Documents/Bitflow2x/source/main.cpp:58:
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp: In
instantiation of 'struct
boost::detail::deduce_target_char_impl<boost::detail::deduce_character_type_later<boost::qvm::vec<float,
3> > >':
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:270:89:
required from 'struct
boost::detail::deduce_target_char<boost::qvm::vec<float, 3> >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:407:92:
required from 'struct boost::detail::lexical_cast_stream_traits<const
char*, boost::qvm::vec<float, 3> >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:468:15:
required from 'struct
boost::detail::lexical_converter_impl<boost::qvm::vec<float, 3>, const
char*>'
/usr/local/include/boost/lexical_cast/try_lexical_convert.hpp:196:44:
required from 'bool boost::conversion::detail::try_lexical_convert(const
Source&, Target&) [with Target = boost::qvm::vec<float, 3>; Source = char
[14]]'
/usr/local/include/boost/lexical_cast.hpp:41:60: required from 'Target
boost::lexical_cast(const Source&) [with Target = boost::qvm::vec<float,
3>; Source = char [14]]'
/home/kique/Documents/Bitflow2x/source/main.cpp:83:72: required from here
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:241:21:
error: 'value' is not a member of
'boost::has_right_shift<std::basic_istream<char>, boost::qvm::vec<float,
3>, boost::detail::has_right_shift_impl::dont_care>'
>::type type;
^~~~
In file included from /usr/local/include/boost/qvm/static_assert.hpp:7:0,
from /usr/local/include/boost/qvm/vec.hpp:11,
from /home/kique/Documents/Bitflow2x/source/main.cpp:57:
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:243:13:
error: 'value' is not a member of
'boost::detail::deduce_target_char_impl<boost::detail::deduce_character_type_later<boost::qvm::vec<float,
3> > >::result_t {aka boost::has_right_shift<std::basic_istream<char>,
boost::qvm::vec<float, 3>, boost::detail::has_right_shift_impl::dont_care>}'
BOOST_STATIC_ASSERT_MSG((result_t::value ||
boost::has_right_shift<std::basic_istream<wchar_t>, T >::value),
^
In file included from /usr/local/include/boost/config.hpp:61:0,
from /usr/local/include/boost/static_assert.hpp:17,
from /usr/local/include/boost/qvm/static_assert.hpp:7,
from /usr/local/include/boost/qvm/vec.hpp:11,
from /home/kique/Documents/Bitflow2x/source/main.cpp:57:
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp: In
instantiation of 'const bool
boost::detail::has_right_shift_impl::operator_exists<std::basic_istream<wchar_t>,
boost::qvm::vec<float, 3> >::value':
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:179:4:
required from 'const bool
boost::detail::has_right_shift_impl::trait_impl1<std::basic_istream<wchar_t>,
boost::qvm::vec<float, 3>, boost::detail::has_right_shift_impl::dont_care,
false>::value'
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:208:4:
required from 'const bool
boost::detail::has_right_shift_impl::trait_impl<std::basic_istream<wchar_t>,
boost::qvm::vec<float, 3>,
boost::detail::has_right_shift_impl::dont_care>::value'
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:216:8:
required from 'struct boost::has_right_shift<std::basic_istream<wchar_t>,
boost::qvm::vec<float, 3>, boost::detail::has_right_shift_impl::dont_care>'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:243:13:
required from 'struct
boost::detail::deduce_target_char_impl<boost::detail::deduce_character_type_later<boost::qvm::vec<float,
3> > >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:270:89:
required from 'struct
boost::detail::deduce_target_char<boost::qvm::vec<float, 3> >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:407:92:
required from 'struct boost::detail::lexical_cast_stream_traits<const
char*, boost::qvm::vec<float, 3> >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:468:15:
required from 'struct
boost::detail::lexical_converter_impl<boost::qvm::vec<float, 3>, const
char*>'
/usr/local/include/boost/lexical_cast/try_lexical_convert.hpp:196:44:
required from 'bool boost::conversion::detail::try_lexical_convert(const
Source&, Target&) [with Target = boost::qvm::vec<float, 3>; Source = char
[14]]'
/usr/local/include/boost/lexical_cast.hpp:41:60: required from 'Target
boost::lexical_cast(const Source&) [with Target = boost::qvm::vec<float,
3>; Source = char [14]]'
/home/kique/Documents/Bitflow2x/source/main.cpp:83:72: required from here
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:158:70:
error: ambiguous overload for 'operator>>' (operand types are
'std::basic_istream<wchar_t>' and 'boost::qvm::vec<float, 3>')
BOOST_STATIC_CONSTANT(bool, value = (sizeof(s_check(((make<Lhs>()
BOOST_TT_TRAIT_OP
make<Rhs>()),make<has_operator>())))==sizeof(::boost::type_traits::yes_type)));
^
In file included from /usr/local/include/c++/7.0.0/iostream:40:0,
from /home/kique/Documents/Bitflow2x/source/main.cpp:56:
/usr/local/include/c++/7.0.0/istream:120:7: note: candidate:
std::basic_istream<_CharT, _Traits>::__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT,
_Traits>::__istream_type& (*)(std::basic_istream<_CharT,
_Traits>::__istream_type&)) [with _CharT = wchar_t; _Traits =
std::char_traits<wchar_t>; std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<wchar_t>]
operator>>(__istream_type& (*__pf)(__istream_type&))
^~~~~~~~
/usr/local/include/c++/7.0.0/istream:124:7: note: candidate:
std::basic_istream<_CharT, _Traits>::__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT,
_Traits>::__ios_type& (*)(std::basic_istream<_CharT,
_Traits>::__ios_type&)) [with _CharT = wchar_t; _Traits =
std::char_traits<wchar_t>; std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<wchar_t>;
std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<wchar_t>]
operator>>(__ios_type& (*__pf)(__ios_type&))
^~~~~~~~
/usr/local/include/c++/7.0.0/istream:131:7: note: candidate:
std::basic_istream<_CharT, _Traits>::__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base&
(*)(std::ios_base&)) [with _CharT = wchar_t; _Traits =
std::char_traits<wchar_t>; std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<wchar_t>]
operator>>(ios_base& (*__pf)(ios_base&))
^~~~~~~~
/usr/local/include/c++/7.0.0/istream:259:7: note: candidate:
std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
_Traits>::operator>>(std::basic_istream<_CharT,
_Traits>::__streambuf_type*) [with _CharT = wchar_t; _Traits =
std::char_traits<wchar_t>; std::basic_istream<_CharT,
_Traits>::__streambuf_type = std::basic_streambuf<wchar_t>]
operator>>(__streambuf_type* __sb);
^~~~~~~~
In file included from
/usr/local/include/boost/type_traits/has_right_shift.hpp:43:0,
from /usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:39,
from /usr/local/include/boost/lexical_cast/try_lexical_convert.hpp:42,
from /usr/local/include/boost/lexical_cast.hpp:32,
from /home/kique/Documents/Bitflow2x/source/main.cpp:58:
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:70:13:
note: candidate: boost::detail::has_right_shift_impl::no_operator
boost::detail::has_right_shift_impl::operator>>(const
boost::detail::has_right_shift_impl::any&, const
boost::detail::has_right_shift_impl::any&)
no_operator operator BOOST_TT_TRAIT_OP (const any&, const any&);
^~~~~~~~
In file included from /usr/local/include/boost/config.hpp:61:0,
from /usr/local/include/boost/static_assert.hpp:17,
from /usr/local/include/boost/qvm/static_assert.hpp:7,
from /usr/local/include/boost/qvm/vec.hpp:11,
from /home/kique/Documents/Bitflow2x/source/main.cpp:57:
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp: In
instantiation of 'const bool
boost::detail::has_right_shift_impl::operator_returns_void<std::basic_istream<wchar_t>,
boost::qvm::vec<float, 3> >::value':
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:179:4:
required from 'const bool
boost::detail::has_right_shift_impl::trait_impl1<std::basic_istream<wchar_t>,
boost::qvm::vec<float, 3>, boost::detail::has_right_shift_impl::dont_care,
false>::value'
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:208:4:
required from 'const bool
boost::detail::has_right_shift_impl::trait_impl<std::basic_istream<wchar_t>,
boost::qvm::vec<float, 3>,
boost::detail::has_right_shift_impl::dont_care>::value'
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:216:8:
required from 'struct boost::has_right_shift<std::basic_istream<wchar_t>,
boost::qvm::vec<float, 3>, boost::detail::has_right_shift_impl::dont_care>'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:243:13:
required from 'struct
boost::detail::deduce_target_char_impl<boost::detail::deduce_character_type_later<boost::qvm::vec<float,
3> > >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:270:89:
required from 'struct
boost::detail::deduce_target_char<boost::qvm::vec<float, 3> >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:407:92:
required from 'struct boost::detail::lexical_cast_stream_traits<const
char*, boost::qvm::vec<float, 3> >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:468:15:
required from 'struct
boost::detail::lexical_converter_impl<boost::qvm::vec<float, 3>, const
char*>'
/usr/local/include/boost/lexical_cast/try_lexical_convert.hpp:196:44:
required from 'bool boost::conversion::detail::try_lexical_convert(const
Source&, Target&) [with Target = boost::qvm::vec<float, 3>; Source = char
[14]]'
/usr/local/include/boost/lexical_cast.hpp:41:60: required from 'Target
boost::lexical_cast(const Source&) [with Target = boost::qvm::vec<float,
3>; Source = char [14]]'
/home/kique/Documents/Bitflow2x/source/main.cpp:83:72: required from here
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:95:114:
error: ambiguous overload for 'operator>>' (operand types are
'std::basic_istream<wchar_t>' and 'boost::qvm::vec<float, 3>')
BOOST_STATIC_CONSTANT(bool, value =
(sizeof(::boost::type_traits::yes_type)==sizeof(returns_void((make<Lhs>()
BOOST_TT_TRAIT_OP make<Rhs>(),returns_void_t())))));
^
In file included from /usr/local/include/c++/7.0.0/iostream:40:0,
from /home/kique/Documents/Bitflow2x/source/main.cpp:56:
/usr/local/include/c++/7.0.0/istream:120:7: note: candidate:
std::basic_istream<_CharT, _Traits>::__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT,
_Traits>::__istream_type& (*)(std::basic_istream<_CharT,
_Traits>::__istream_type&)) [with _CharT = wchar_t; _Traits =
std::char_traits<wchar_t>; std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<wchar_t>]
operator>>(__istream_type& (*__pf)(__istream_type&))
^~~~~~~~
/usr/local/include/c++/7.0.0/istream:124:7: note: candidate:
std::basic_istream<_CharT, _Traits>::__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT,
_Traits>::__ios_type& (*)(std::basic_istream<_CharT,
_Traits>::__ios_type&)) [with _CharT = wchar_t; _Traits =
std::char_traits<wchar_t>; std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<wchar_t>;
std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<wchar_t>]
operator>>(__ios_type& (*__pf)(__ios_type&))
^~~~~~~~
/usr/local/include/c++/7.0.0/istream:131:7: note: candidate:
std::basic_istream<_CharT, _Traits>::__istream_type&
std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base&
(*)(std::ios_base&)) [with _CharT = wchar_t; _Traits =
std::char_traits<wchar_t>; std::basic_istream<_CharT,
_Traits>::__istream_type = std::basic_istream<wchar_t>]
operator>>(ios_base& (*__pf)(ios_base&))
^~~~~~~~
/usr/local/include/c++/7.0.0/istream:259:7: note: candidate:
std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
_Traits>::operator>>(std::basic_istream<_CharT,
_Traits>::__streambuf_type*) [with _CharT = wchar_t; _Traits =
std::char_traits<wchar_t>; std::basic_istream<_CharT,
_Traits>::__streambuf_type = std::basic_streambuf<wchar_t>]
operator>>(__streambuf_type* __sb);
^~~~~~~~
In file included from
/usr/local/include/boost/type_traits/has_right_shift.hpp:43:0,
from /usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:39,
from /usr/local/include/boost/lexical_cast/try_lexical_convert.hpp:42,
from /usr/local/include/boost/lexical_cast.hpp:32,
from /home/kique/Documents/Bitflow2x/source/main.cpp:58:
/usr/local/include/boost/type_traits/detail/has_binary_operator.hpp:70:13:
note: candidate: boost::detail::has_right_shift_impl::no_operator
boost::detail::has_right_shift_impl::operator>>(const
boost::detail::has_right_shift_impl::any&, const
boost::detail::has_right_shift_impl::any&)
no_operator operator BOOST_TT_TRAIT_OP (const any&, const any&);
^~~~~~~~
In file included from /usr/local/include/boost/qvm/static_assert.hpp:7:0,
from /usr/local/include/boost/qvm/vec.hpp:11,
from /home/kique/Documents/Bitflow2x/source/main.cpp:57:
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp: In
instantiation of 'struct
boost::detail::deduce_target_char_impl<boost::detail::deduce_character_type_later<boost::qvm::vec<float,
3> > >':
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:270:89:
required from 'struct
boost::detail::deduce_target_char<boost::qvm::vec<float, 3> >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:407:92:
required from 'struct boost::detail::lexical_cast_stream_traits<const
char*, boost::qvm::vec<float, 3> >'
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:468:15:
required from 'struct
boost::detail::lexical_converter_impl<boost::qvm::vec<float, 3>, const
char*>'
/usr/local/include/boost/lexical_cast/try_lexical_convert.hpp:196:44:
required from 'bool boost::conversion::detail::try_lexical_convert(const
Source&, Target&) [with Target = boost::qvm::vec<float, 3>; Source = char
[14]]'
/usr/local/include/boost/lexical_cast.hpp:41:60: required from 'Target
boost::lexical_cast(const Source&) [with Target = boost::qvm::vec<float,
3>; Source = char [14]]'
/home/kique/Documents/Bitflow2x/source/main.cpp:83:72: required from here
/usr/local/include/boost/lexical_cast/detail/converter_lexical.hpp:243:13:
error: 'value' is not a member of
'boost::has_right_shift<std::basic_istream<wchar_t>, boost::qvm::vec<float,
3>, boost::detail::has_right_shift_impl::dont_care>'
BOOST_STATIC_ASSERT_MSG((result_t::value ||
boost::has_right_shift<std::basic_istream<wchar_t>, T >::value),
^
ninja: build stopped: subcommand failed.
2
1
The release candidates for the 1.62.0 release are now available at:
https://sourceforge.net/projects/boost/files/boost/1.62.0.rc.1/boost_1_62_0…
https://sourceforge.net/projects/boost/files/boost/1.62.0.rc.1/boost_1_62_0…
https://sourceforge.net/projects/boost/files/boost/1.62.0.rc.1/boost_1_62_0…
https://sourceforge.net/projects/boost/files/boost/1.62.0.rc.1/boost_1_62_0…
The SHA256 checksums are as follows:
b91c2cda8bee73ea613130e19e72c9589e9ef0357c4c5cc5f7523de82cce11f7
boost_1_62_0_rc1.7z
36c96b0f6155c98404091d8ceb48319a28279ca0333fba1ad8611eb90afb2ca0
boost_1_62_0_rc1.tar.bz2
440a59f8bc4023dbe6285c9998b0f7fa288468b889746b1ef00e8b36c559dce1
boost_1_62_0_rc1.tar.gz
084b2e0638bbe0975a9e43e21bc9ceae33ef11377aecab3268a57cf41e405d4e
boost_1_62_0_rc1.zip
As always, the release managers would appreciate it if you download
the candidate of your choice and give building it a try. Please report
both success and failure, and anything else that is noteworthy.
Thanks, the release managers.
--
-- Rene Rivera
-- Grafik - Don't Assume Anything
-- Robot Dreams - http://robot-dreams.net
-- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail
5
6
Hi All,
I seem to remember reading about this [the subject of this post] in the
docs, but I don't seem to be able to find it [that page] now.
What criteria should I use to choose a specific Boost.Heap implementation
(skew, fibonacci etc), from the ones provided by the Boost.Heap library?
Thanks in advance and have a good day,
degski
3
10
Hi,
This is my second 'account' to this mailing list. In fact I am a freelance who works for a company that works for another company and when I am somewhere I can't have access to the 'elsewhere' outlook.
I am an old C++ (and FORTRAN and Visual Foxpro) programmer. But I am new to boost, windows (MFC) and Visual Studio 2010. My challenge is to 'upgrade' a huge app (250 k lines of code) both Windows and Linux from boost 1.3.x (and stingray and .....) to boost 1.50 and win 7 ... Boost 1.50 is the last version our customer can use because of its 'private' version of Debian.
I am first dealing with windows. When I compile the solution, I get a lot of errors and I would like you give me the first steps to do.
Here is an example about file ...\boost\boost15\boost_1_50_0\boost/mpl/list/aux_/preprocessed/plain/list20.hpp
list20.hpp(157): error C2143: syntax error : missing ',' before 'string'
list20.hpp(163): error C2974: 'boost::mpl::list19' : invalid template argument for 'T18', type expected
list20.hpp(144) : see declaration of 'boost::mpl::list19'
list20.hpp(167) : see reference to class template instantiation 'boost::mpl::list20<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,__formal>' being compiled
list20.hpp(164): error C3203: 'list19' : unspecialized class template can't be used as a template argument for template parameter 'Next', expected a real type
list20.hpp(164): error C2955: 'boost::mpl::list19' : use of class template requires template argument list
list20.hpp(144) : see declaration of 'boost::mpl::list19'
list20.hpp(165): error C2955: 'boost::mpl::l_item' : use of class template requires template argument list
So if you can explain me what is wrong (I mean I am astonished (?) to find a syntax error and I think I must not modify the file so the error may come from elsewhere ...)
TIA
Jean
2
3
Hi, guys. I have a problem with Boost fiber in 1.62 beta 2. My machine is a 4 core machine with 64bit ubuntu 14.04 installed. In my program, I created 4 kernel threads each of which uses the round robin fiber scheduler. One thread 1, I created one fiber that read data from a socket in a blocking manner. Once it got some data, it writes the data into a blocking fiber channel. For the rest thread kernel threads, I created 5 fibers for each of them. They all read (in a blocking manner) data from the same channel.
My problem is when no data is sent to the socket, and the system is idling, I can see very high CPU usage on three cores. I profiled the code, it seems to me that the kernel threads keep calling fiber scheduler to sleep then wake up again. I suspect that the time interval for the function suspend_until() may be too short. If that is the case, then how can I increase it?
2
1
25 Sep '16
Hi all,
currently i try to measure the runtime overhead of serialization vs. plain
c-style serialization. The goal is to send it from one process to an other
process on the same machine. As my statemachines are written with
boost::msm, i want to deliver types.
For the IPC i used interprocess::message_queue. I wrote a template
function for the test and added a trait to plug in the test functions.
I tested on the same machine, once with Linux Debian stretch x64 and Win
10 x64 MSVC 2015.
What really astonish me is the fact, that the measured times using
boost::serilization is so high compared to "c-style: id + data" method. In
the c-style method i used a FNV hash of the type name as the ID.
All tests were done on a Intel Core i7 2670QM CPU. All results in sec.
I sent/received 100000 objects over a message_queue.
Boost 1.61.0 Linux x86_64 / gcc 6.1.1 Win 10 x64/ MSVC 2015
Boost XML Send 2.220753 8.255834
Boost XML Receive 3.208353 10.14462
Boost Text Send 2.024946 8.578654
Boost Text Receive 3.207359 10.704126
Boost BinarySend 2.018026 8.363865
Boost Binary Receive 3.17984 11.201501
Cstyle Send 0.13566 0.056814
Cstyle Receive 0.087906 0.058706
Char Send 0.071683 0.013965
Char Receive 0.062119 0.012631
To measure the real overhead of the message passing, i made a test and
just sent 100000 plain chars over the "wire".
There are two strange things:
a) The serilization with boost seems to be about 16 times slower than the
plain c-style method, the receive seems to be about 30 times slower. I
think i do something wrong..... he tests were compiled on release mode.
b) On the same hardware, the Windows implementation is so much slower than
the Linux one... about factor 3. But at the c-style method, it turns
around.... Linux is slower than Windows.
Has anyone an idea whats the issue here?
I added the code at the end of this text
Best regards
Georg
// -----------------------------------------------------
// Code
// -----------------------------------------------------
#define BOOST_TEST_MODULE first_tests
#include <boost/test/unit_test.hpp>
#include <boost/interprocess/ipc/message_queue.hpp> // send all data
through this
#include <boost/timer/timer.hpp> // measure the used time
#include <iostream> // for output
// STL Archive + Stuff
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/unique_ptr.hpp>
// include headers that implement a archive in xml format
#include <boost/archive/archive_exception.hpp>
#include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/iostreams/device/array.hpp>
#include <boost/iostreams/device/back_inserter.hpp>
#include <boost/iostreams/stream.hpp>
#include <memory>
#include <stdint.h>
#include <typeinfo>
#include <vector>
using namespace boost::interprocess;
static const int test_count = 100000; // send this many structs
// the test structure
struct ev_test
{
long a = 1;
unsigned long b = 2;
};
//
----------------------------------------------------------------------------
// a packet on the wire
//
----------------------------------------------------------------------------
using packet = std::vector<char>;
//-----------------------------------------------------------------------------
// Type carrier and its support
//
----------------------------------------------------------------------------
namespace
{
class carrier_visitor_base;
class carrier_base // the base in the queue
{
public:
using ptr = std::unique_ptr<carrier_base>;
virtual ~carrier_base() {}
virtual void accept(carrier_visitor_base *p_visitor) = 0;
template <class Archive>
void serialize(Archive &ar, const unsigned int version)
{
}
};
template <typename T>
class carrier;
class carrier_visitor_base
{
public:
virtual ~carrier_visitor_base() {}
virtual void handle(carrier<ev_test> *p_evt) = 0;
virtual void handle(carrier<char> *p_evt) = 0;
};
template <typename T>
class carrier : public carrier_base // the specific carrier
{
public:
explicit carrier() : m_data() {}
explicit carrier(const T &data) : m_data(data) {}
virtual void accept(carrier_visitor_base *p_visitor) override
{
p_visitor->handle(this);
}
T &data() { return m_data; }
private:
T m_data;
};
} // ns anon
//
----------------------------------------------------------------------------
// the traits for the chartest
//
----------------------------------------------------------------------------
struct char_test
{
static const char *name() { return "char_test 'c': "; }
static size_t msg_size() { return sizeof(char); }
static char get_data() { return 'c'; }
template <typename T>
static packet to_wire(T data)
{
packet ret;
ret.push_back(get_data());
return ret;
}
static carrier_base::ptr from_wire(const packet &data)
{
auto p_data = new carrier<char>();
p_data->data() = data[0];
return std::unique_ptr<carrier<char>>(p_data);
}
};
//
----------------------------------------------------------------------------
// the traits for the boost xml serialization test
//
----------------------------------------------------------------------------
//
----------------------------------------------------------------------------
// external serialization function
//
----------------------------------------------------------------------------
namespace boost
{
namespace serialization
{
// serialization function for ev_test
template <class Archive>
inline void serialize(Archive &ar, ev_test &t, const unsigned int version)
{
ar &BOOST_SERIALIZATION_NVP(t.a);
ar &BOOST_SERIALIZATION_NVP(t.b);
}
// serialization function for carrier<T>
template <class Archive, typename T>
void serialize(Archive &ar, carrier<T> &t, const unsigned int version)
{
ar &boost::serialization::make_nvp(
"carrier_base", boost::serialization::base_object<carrier_base>(t));
// BOOST_SERIALIZATION_BASE_OBJECT_NVP(a);
auto &data = t.data();
ar &BOOST_SERIALIZATION_NVP(data);
}
}
}
// we must export all carrier
BOOST_SERIALIZATION_SHARED_PTR(carrier<ev_test>)
BOOST_CLASS_EXPORT(carrier<ev_test>)
struct boost_xml_trait
{
static const char *name() { return "boost_xml_test: ev_test: "; }
typedef boost::archive::xml_oarchive oarchive;
typedef boost::archive::xml_iarchive iarchive;
};
struct boost_text_trait
{
static const char *name() { return "boost_text_test: ev_test: "; }
typedef boost::archive::xml_oarchive oarchive;
typedef boost::archive::xml_iarchive iarchive;
};
struct boost_binary_trait
{
static const char *name() { return "boost_binary_test: ev_test: "; }
typedef boost::archive::xml_oarchive oarchive;
typedef boost::archive::xml_iarchive iarchive;
};
template <typename archive_trait>
struct boost_test
{
static const char *name() { return archive_trait::name(); }
static size_t msg_size() { return 600; }
// throws boost::archive::archive_exception
template <typename T>
static packet to_wire(T data)
{
using namespace boost::iostreams;
using T1 = typename std::remove_cv<T>::type;
using BT = typename std::remove_reference<T1>::type;
carrier_base::ptr p_carrier = std::make_unique<carrier<BT>>(data);
packet p;
{
back_insert_device<packet> sink{ p };
stream<back_insert_device<packet>> os{ sink };
typename archive_trait::oarchive oa(os);
oa << BOOST_SERIALIZATION_NVP(p_carrier);
}
return p;
}
// throws boost::archive::archive_exception
static carrier_base::ptr from_wire(const packet &data)
{
using namespace boost::iostreams;
carrier_base::ptr p_carrier;
boost::iostreams::array_source source{ data.data(), data.size() };
stream<array_source> is{ source };
typename archive_trait::iarchive ia(is); // this takes the most time
ia >> BOOST_SERIALIZATION_NVP(p_carrier);
return p_carrier;
}
};
//
----------------------------------------------------------------------------
// the traits for the cstyle serialization test
//
----------------------------------------------------------------------------
//
----------------------------------------------------------------------------
// cstyle serialization with fnv type identifier
//
----------------------------------------------------------------------------
struct cstyle_test
{
static const char *name() { return "cstyle_test: "; }
static size_t msg_size() { return 1000; }
// Fowler–Noll–Vo hash function
//
https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
struct fnv
{
const static uint64_t base = 0xcbf29ce484222325;
const static uint64_t prime = 0x00000100000001b3;
const static uint64_t next(uint64_t current, size_t char_code)
{
return (current ^ char_code) * prime;
}
const static uint64_t value(const char *cptr,
uint64_t interim = base)
{
return (*cptr == '\0')
? interim
: value(cptr + 1,
next(interim, static_cast<size_t>(*cptr)));
}
};
template <typename T>
static packet to_wire(T data)
{
packet buffer(msg_size()); // to be fair, send the same amount of bytes
const uint64_t id = fnv::value(typeid(T).name());
size_t pos = 0;
assert(msg_size() >= sizeof(uint64_t) + sizeof(T));
// buffer.resize(buffer.size() + sizeof(uint64_t) + sizeof(T));
std::memcpy(buffer.data() + pos, &id, sizeof(uint64_t));
pos += sizeof(uint64_t);
std::memcpy(buffer.data() + pos, &data, sizeof(T));
pos += sizeof(T);
return buffer;
}
static carrier_base::ptr from_wire(const packet &data)
{
// get the id
size_t pos = 0;
uint64_t id;
std::memcpy(&id, data.data() + pos, sizeof(uint64_t));
pos += sizeof(uint64_t);
// create the specific pointer
if (id == fnv::value(typeid(ev_test).name()))
{
assert(data.size() >= sizeof(uint64_t) + sizeof(ev_test));
auto p_evt = new carrier<ev_test>();
std::memcpy(&p_evt->data(), data.data() + pos, sizeof(ev_test));
return carrier_base::ptr(p_evt);
}
throw std::runtime_error("deserialize error");
}
};
template <typename trait>
void do_test()
{
class runtime : public carrier_visitor_base
{
public:
virtual void handle(carrier<ev_test> *p_evt) override
{
i += p_evt->data().a;
}
virtual void handle(carrier<char> *p_evt) override
{
i += p_evt->data();
}
int i = 0;
};
try
{
std::cout << "Sending " << trait::name() << test_count << std::endl;
// Erase previous message queue
message_queue::remove("message_queue");
// Create a message_queue.
message_queue mq(create_only // only create
,
"message_queue" // name
,
test_count // max message number
,
trait::msg_size() // max message size
);
// send ev_tests
boost::timer::auto_cpu_timer t;
for (int i = 0; i < test_count; ++i)
{
auto buffer = trait::to_wire(ev_test());
mq.send(buffer.data(), buffer.size(), 0);
}
}
catch (const interprocess_exception &ex)
{
message_queue::remove("message_queue");
std::cout << ex.what() << std::endl;
BOOST_CHECK(true == false);
}
runtime rt;
try
{
std::cout << "Receiving " << trait::name() << test_count << std::endl;
// Open a message queue.
message_queue mq(open_only // only create
,
"message_queue" // name
);
message_queue::size_type recvd_size;
packet buffer(trait::msg_size());
unsigned int priority;
boost::timer::auto_cpu_timer t;
for (int i = 0; i < test_count; ++i)
{
// receive the raw data
mq.receive(buffer.data(), buffer.size(), recvd_size, priority);
// deserialize
auto p_carrier = trait::from_wire(buffer);
// handle it to the protocol
p_carrier->accept(&rt);
}
}
catch (const interprocess_exception &ex)
{
message_queue::remove("message_queue");
std::cout << ex.what() << std::endl;
BOOST_CHECK(true == false);
}
message_queue::remove("message_queue");
std::cout << "RT Counter: " << rt.i << std::endl << std::endl;
}
BOOST_AUTO_TEST_CASE(carrier_boost_xml_ev_test)
{
do_test<boost_test<boost_xml_trait>>();
}
BOOST_AUTO_TEST_CASE(carrier_boost_text_ev_test)
{
do_test<boost_test<boost_text_trait>>();
}
BOOST_AUTO_TEST_CASE(carrier_boost_binary_ev_test)
{
do_test<boost_test<boost_binary_trait>>();
}
BOOST_AUTO_TEST_CASE(carrier_cstyle_ev_test) { do_test<cstyle_test>(); }
BOOST_AUTO_TEST_CASE(carrier_char_test) { do_test<char_test>(); }
6
20