SlHelpers
Toggle main menu visibility
Loading...
Searching...
No Matches
pybindSupp.h
1
// SPDX-License-Identifier: GPL-2.0-only
2
3
#pragma once
4
5
#include <chrono>
6
7
#include <pybind11/pybind11.h>
8
9
namespace
pybind11::detail {
10
11
template
<>
struct
type_caster<std::chrono::year_month_day> {
12
PYBIND11_TYPE_CASTER(std::chrono::year_month_day, _(
"datetime.date"
));
13
static
handle cast(std::chrono::year_month_day ymd, return_value_policy, handle) {
14
return
pybind11::module_::import(
"datetime"
).attr(
"date"
)(
15
int(ymd.year()),
16
unsigned(ymd.month()),
17
unsigned(ymd.day())
18
).release();
19
}
20
};
21
22
}
src
pybind
pybindSupp.h
Generated by
1.17.0