U
Hab jetzt von anderer Seite gehört ich soll doch folgendes verwenden
typdef std::list<boost::any> AnyList;
hat mit dem std::list und vor allem mit dem boost::any schon jemand erfahrung gemacht??
hab jetzt
mal
#include <list>;
und
#include <boost/any.hpp>
in der Main:
// Include für std::list
#include <list>
#include <boost/any.hpp>
using boost::any_cast;
typedef std::listboost::any many;
aber ausser geschätzen 500 Warnungen und einem Fehler erreiche ich nix...
hab das boost-Verzeichniss ins Programmunterverzeichnniss kopiert...
das ganze unter Linux 8.1
anbei die Fehlermeldung
from boost/any.hpp:17,
from main.cpp:36:
boost/mpl/aux_/config/ctps.hpp:22:46: warning: "__BORLANDC__" is not defined
In file included from boost/any.hpp:17,
from main.cpp:36:
boost/type_traits/remove_reference.hpp:16:39: warning: "BOOST_MSVC" is not defined
In file included from boost/mpl/aux_/adl_barrier.hpp:17,
from boost/mpl/int_fwd.hpp:17,
from boost/mpl/int.hpp:17,
from boost/type_traits/detail/template_arity_spec.hpp:10,
from boost/type_traits/detail/type_trait_def.hpp:14,
from boost/type_traits/remove_reference.hpp:21,
from boost/any.hpp:17,
from main.cpp:36:
boost/mpl/aux_/config/adl.hpp:29:62: warning: "BOOST_MSVC" is not defined
boost/mpl/aux_/config/adl.hpp:30:50: warning: "__BORLANDC__" is not defined
boost/mpl/aux_/config/adl.hpp:31:60: warning: "__DMC__" is not defined
boost/mpl/aux_/config/adl.hpp:32:64: warning: "__MWERKS__" is not defined
boost/mpl/aux_/config/adl.hpp:33:74: warning: "BOOST_INTEL_CXX_VERSION" is not defined
In file included from boost/mpl/aux_/nttp_decl.hpp:17,
from boost/mpl/int_fwd.hpp:18,
from boost/mpl/int.hpp:17,
from boost/type_traits/detail/template_arity_spec.hpp:10,
from boost/type_traits/detail/type_trait_def.hpp:14,
from boost/type_traits/remove_reference.hpp:21,
from boost/any.hpp:17,
from main.cpp:36:
boost/mpl/aux_/config/nttp.hpp:35:43: warning: "BOOST_MSVC" is not defined
In file included from boost/mpl/aux_/integral_wrapper.hpp:17,
from boost/mpl/int.hpp:20,
from boost/type_traits/detail/template_arity_spec.hpp:10,
from boost/type_traits/detail/type_trait_def.hpp:14,
from boost/type_traits/remove_reference.hpp:21,
from boost/any.hpp:17,
from main.cpp:36:
boost/mpl/aux_/static_cast.hpp:19:58: warning: "__BORLANDC__" is not defined
boost/mpl/aux_/static_cast.hpp:21:43: warning: "__MWERKS__" is not defined
In file included from boost/mpl/int.hpp:20,
from boost/type_traits/detail/template_arity_spec.hpp:10,
from boost/type_traits/detail/type_trait_def.hpp:14,
from boost/type_traits/remove_reference.hpp:21,
from boost/any.hpp:17,
from main.cpp:36:
boost/mpl/aux_/integral_wrapper.hpp:33:46: warning: "__MWERKS__" is not defined
boost/mpl/aux_/integral_wrapper.hpp:48:45: warning: "__EDG_VERSION__" is not defined
boost/mpl/aux_/integral_wrapper.hpp:59:45: warning: "__EDG_VERSION__" is not defined
boost/mpl/aux_/integral_wrapper.hpp:66:60: warning: "__BORLANDC__" is not defined
boost/mpl/aux_/integral_wrapper.hpp:67:57: warning: "__IBMCPP__" is not defined
boost/mpl/aux_/integral_wrapper.hpp:68:43: warning: "__HP_aCC" is not defined
In file included from boost/mpl/aux_/preprocessor/params.hpp:17,
from boost/type_traits/detail/template_arity_spec.hpp:12,
from boost/type_traits/detail/type_trait_def.hpp:14,
from boost/type_traits/remove_reference.hpp:21,
from boost/any.hpp:17,
from main.cpp:36:
boost/mpl/aux_/config/preprocessor.hpp:20:50: warning: "__MWERKS__" is not defined
boost/mpl/aux_/config/preprocessor.hpp:21:65: warning: "__BORLANDC__" is not defined
boost/mpl/aux_/config/preprocessor.hpp:22:61: warning: "__IBMCPP__" is not defined
boost/mpl/aux_/config/preprocessor.hpp:34:56: warning: "__DMC__" is not defined
In file included from boost/type_traits/detail/template_arity_spec.hpp:14,
from boost/type_traits/detail/type_trait_def.hpp:14,
from boost/type_traits/remove_reference.hpp:21,
from boost/any.hpp:17,
from main.cpp:36:
boost/mpl/aux_/config/overload_resolution.hpp:21:50: warning: "__BORLANDC__" is not defined
boost/mpl/aux_/config/overload_resolution.hpp:22:49: warning: "__MWERKS__" is not defined
In file included from boost/type_traits/is_reference.hpp:24,
from boost/any.hpp:18,
from main.cpp:36:
boost/type_traits/config.hpp:29:44: warning: "__MWERKS__" is not defined
boost/type_traits/config.hpp:30:44: warning: "BOOST_MSVC" is not defined
boost/type_traits/config.hpp:32:43: warning: "__IBMCPP__" is not defined
boost/type_traits/config.hpp:33:61: warning: "__BORLANDC__" is not defined
boost/type_traits/config.hpp:35:57: warning: "__HP_aCC" is not defined
boost/type_traits/config.hpp:36:58: warning: "MPW_CPLUS" is not defined
boost/type_traits/config.hpp:37:60: warning: "__SUNPRO_CC" is not defined
boost/type_traits/config.hpp:70:42: warning: "__MWERKS__" is not defined
boost/type_traits/config.hpp:70:82: warning: "__IBMCPP__" is not defined
In file included from boost/mpl/integral_c.hpp:17,
from boost/type_traits/integral_constant.hpp:11,
from boost/type_traits/detail/bool_trait_def.hpp:15,
from boost/type_traits/is_reference.hpp:32,
from boost/any.hpp:18,
from main.cpp:36:
boost/mpl/integral_c_fwd.hpp:22:40: warning: "__HP_aCC" is not defined
In file included from boost/type_traits/integral_constant.hpp:11,
from boost/type_traits/detail/bool_trait_def.hpp:15,
from boost/type_traits/is_reference.hpp:32,
from boost/any.hpp:18,
from main.cpp:36:
boost/mpl/integral_c.hpp:22:40: warning: "__HP_aCC" is not defined
In file included from boost/mpl/integral_c.hpp:32,
from boost/type_traits/integral_constant.hpp:11,
from boost/type_traits/detail/bool_trait_def.hpp:15,
from boost/type_traits/is_reference.hpp:32,
from boost/any.hpp:18,
from main.cpp:36:
boost/mpl/aux_/integral_wrapper.hpp:48:45: warning: "__EDG_VERSION__" is not defined
boost/mpl/aux_/integral_wrapper.hpp:59:45: warning: "__EDG_VERSION__" is not defined
boost/mpl/aux_/integral_wrapper.hpp:66:60: warning: "__BORLANDC__" is not defined
boost/mpl/aux_/integral_wrapper.hpp:67:57: warning: "__IBMCPP__" is not defined
boost/mpl/aux_/integral_wrapper.hpp:68:43: warning: "__HP_aCC" is not defined
In file included from boost/type_traits/integral_constant.hpp:11,
from boost/type_traits/detail/bool_trait_def.hpp:15,
from boost/type_traits/is_reference.hpp:32,
from boost/any.hpp:18,
from main.cpp:36:
boost/mpl/integral_c.hpp:36:45: warning: "__BORLANDC__" is not defined
In file included from boost/type_traits/detail/bool_trait_def.hpp:15,
from boost/type_traits/is_reference.hpp:32,
from boost/any.hpp:18,
from main.cpp:36:
boost/type_traits/integral_constant.hpp:27:40: warning: "BOOST_MSVC" is not defined
boost/type_traits/integral_constant.hpp:38:40: warning: "BOOST_MSVC" is not defined
In file included from boost/any.hpp:20,
from main.cpp:36:
boost/static_assert.hpp:94:45: warning: "__MWERKS__" is not defined
main.cpp: In function `void LoadLibrary(int)':
main.cpp:205: warning: invalid conversion from `void*' to `const
char*(*)(TModulK)'
main.cpp:220: warning: invalid conversion from `const char*' to `char*'
main.cpp:246: warning: invalid conversion from `void*' to `const
char*(*)(TModulK)'
main.cpp:259: warning: too many arguments for format
main.cpp:286: warning: invalid conversion from `void*' to `const
char*(*)(TModulK)'
main.cpp:300: warning: too many arguments for format
main.cpp: In function `int main(int, char**)':
main.cpp:415: warning: unused parameter `int argc'
/bin/sh ../libtool --silent --mode=link --tag=CXX g++ -Wnon-virtual-dtor -Wno-long-long -Wbad-function-cast -Wundef -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -O2 -O0 -g3 -Wall -fno-exceptions -fno-check-new -ldl -o projektxml readxmlfile.o deletefunc.o searchfunc.o outputfunc.o standardstructs.o inputfunc.o tinyxmlstr.o tinyxmlparser.o tinyxmlerror.o tinyxml.o main.o
main.o: In function `char const* boost::any_cast<char const*>(boost::any const&)':
/usr/usr/ready/ben/funktioniert/projektxml/projektxml/main.cpp:80: undefined reference to `boost::throw_exception(std::exception const&)'
in main Zeile 80 steht folgendes...
//********************************************
// Funktionen für Boost
//********************************************
77 void append_int(many & values, int value)
78 {
79 boost::any to_append = value;
80 values.push_back(to_append);
81 }
Der Code ist der Standardcode aus der Docu von Boostn zu boost::any
Wer kann mir eine lauffähige Demo geben... ?? Hab nämlich schon von anderer Seite gehört das die Docu zu boost ziemlich bescheiden ist.
mfg UFOSWORLD
p.s. zu Union hab ich nix gutes gehört , genauso wie zu void*