Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:17:57

0001 /*
0002     tests/test_class.cpp -- test py::class_ definitions and basic functionality
0003 
0004     Copyright (c) 2019 Roland Dreier <roland.dreier@gmail.com>
0005 
0006     All rights reserved. Use of this source code is governed by a
0007     BSD-style license that can be found in the LICENSE file.
0008 */
0009 
0010 #include "pybind11_tests.h"
0011 
0012 TEST_SUBMODULE(union_, m) {
0013     union TestUnion {
0014         int value_int;
0015         unsigned value_uint;
0016     };
0017 
0018     py::class_<TestUnion>(m, "TestUnion")
0019         .def(py::init<>())
0020         .def_readonly("as_int", &TestUnion::value_int)
0021         .def_readwrite("as_uint", &TestUnion::value_uint);
0022 }