Skip to content

Instantly share code, notes, and snippets.

Victor Zverovich vitaut

Block or report user

Report or block vitaut

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View fmt-all.h
/*
Formatting library for C++
Copyright (c) 2012 - present, Victor Zverovich
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
View test.cc
#include "asl.h"
int main() {
ASL *asl = ASL_alloc(ASL_read_fg);
FILE *f = jac0dim("test.nl", 0);
fg_read(f, 0);
fint ne = 0;
double x[] = { 0, 0 };
double objval = asl->p.Objval(asl, 0, x, &ne);
printf("%g %d\n", objval, ne);
View custom-char
#define FMT_HEADER_ONLY
#include "format.h"
struct Syschar {
char c;
Syschar(char c = 0) : c(c) {}
operator char() const { return c; }
};
namespace fmt {
View nlreader-example.cc
#include "mp/nl-reader.h"
enum Expr {OTHER, CONST};
struct ExprCounter : mp::NullNLHandler<Expr> {
int num_divs;
ExprCounter() : num_divs(0) {}
Expr OnBinary(mp::expr::Kind kind, Expr lhs, Expr rhs) {
if (kind == mp::expr::DIV && rhs != CONST)
++num_divs;
You can’t perform that action at this time.