tinyopt 700
Tinyopt, a lightweight, header only optimization library
Loading...
Searching...
No Matches
log.h
1// Copyright 2026 Julien Michot.
2// SPDX-License-Identifier: Apache-2.0
3
4#pragma once
5
6#ifndef TINYOPT_FORMAT_NS
7#ifdef HAS_FMT
8#include <fmt/core.h>
9#include <fmt/ostream.h>
10#define TINYOPT_FORMAT_NS fmt
11#else
12#include <format>
13#define TINYOPT_FORMAT_NS std
14#endif
15#endif
16
17#ifndef TINYOPT_LOG
18#include <iostream>
19#define TINYOPT_LOG(...) std::cout << TINYOPT_FORMAT_NS::format(__VA_ARGS__) << std::endl;
20#endif
21
22#define TINYOPT_LOG_MAT(m) \
23 TINYOPT_LOG("{}:{}x{}{}{}", #m, m.rows(), m.cols(), m.cols() == 1 ? "" : "\n", m);
24// Include formatters
25#ifndef TINYOPT_NO_FORMATTERS
26#include "tinyopt/formatters.h"
27#endif // TINYOPT_NO_FORMATTERS