File: test_classes.h

package info (click to toggle)
nanobind 2.11.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,300 kB
  • sloc: cpp: 12,232; python: 6,315; ansic: 4,813; makefile: 22; sh: 15
file content (21 lines) | stat: -rw-r--r-- 425 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once

#include <memory>

class NeverDestruct {
  public:
    static NeverDestruct& make();

    NeverDestruct(const NeverDestruct&) = delete;
    NeverDestruct& operator=(const NeverDestruct&) = delete;

    int var() const;
    void set_var(int i);

  private:
    NeverDestruct();

    // incomplete type error if nanobind tries to instantiate the destructor
    struct NDImpl;
    std::unique_ptr<NDImpl> impl;
};