]> git.wh0rd.org - ICEs.git/blame - 321197/pyside.ii
more
[ICEs.git] / 321197 / pyside.ii
CommitLineData
bd3239d2
MF
1class QString { public:inline QString(const int i); };
2class object {};
3template < class T > struct rvalue_from_python_data {
4 ~rvalue_from_python_data();
5};
6template < class T > struct extract_rvalue {
7 typedef const T & result_type;
8 mutable rvalue_from_python_data < T > m_data;
9};
10template < class T > struct extract:extract_rvalue < T > {
11 private:typedef extract_rvalue < T > base;
12 public:typedef typename base::result_type result_type;
13 operator result_type() const {}
14 extract(object const &);
15};
16template < class Key, class T > class QHash {
17 public:inline QHash() {}
18 T & operator[](const Key & key);
19};
20
21class type_details {
22 typedef object(*func_python_to_cpp_type) (const object &);
23 public:
24 template < typename T > static type_details *create_value_type_details() {
25 type_details *self = new type_details();
26 self->m_func_python_to_cpp = &python_to_value_type < T >;
27 } func_python_to_cpp_type m_func_python_to_cpp;
28 template < class T > static object python_to_value_type(const object & obj) {
29 T *val = new T(extract < T > (obj));
30 }
31};
32
33class type_manager {
34 public: static type_manager & instance();
35 template < typename T > void register_value_type() {
36 m_type_map[0] = type_details::create_value_type_details < T > ();
37 }
38 QHash < QString, type_details * >m_type_map;
39};
40
41void foo()
42{
43 type_manager::instance().register_value_type < object > ();
44}