This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
double f(double x, int* nbeval) { | |
(*nbeval)++; | |
return 1/(1+x*x); | |
// replace with 1/(1+x) to obtain log(2) ! | |
} | |
double intg(double a,double b, double eps, int* nbeval) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <chrono> | |
#include <iostream> | |
#include <map> | |
#include <random> | |
#include <set> | |
#include <vector> | |
// GOAL : benchmark containers for these 2 operations | |
// - Insert a pair of ints into the container |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <map> | |
int main() { | |
std::map<int, int> m; | |
auto display_m = [&m](const char *msg) { | |
std::cout << msg << " "; | |
for (auto [k, v] : m) { | |
std::cout << "m[" << k << "] = " << v << std::endl; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WatchedConstraint | |
{ | |
public: | |
WatchedConstraint(std::string name, std::string regexID, std::string infeasibility, std::string infeasibilityCause) : | |
name(name), | |
regexID(regexID), | |
infeasibility(infeasibility), | |
infeasibilityCause(infeasibilityCause) { | |
} | |
std::string formattedInfeasibility(std::string constraintName) const { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
class Poly | |
{ | |
public: | |
virtual std::string name() const = 0; | |
virtual ~Poly() = default; | |
}; | |
class Impl1 : public Poly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <map> | |
#include <cmath> | |
using uint = unsigned int; | |
std::map<std::string, uint> getRawNumberCoresPerLevel(uint nbLogicalCores) | |
{ | |
std::map<std::string, uint> table; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cassert> | |
#include <mutex> | |
#include <vector> | |
class IMutex | |
{ | |
public: | |
virtual void lock() = 0; | |
virtual void unlock() noexcept = 0; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cassert> | |
enum class C | |
{ | |
LINEAR, | |
NON_LINEAR, | |
CONSTANT | |
}; | |
C operator+(C x, C y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdexcept> | |
class IName | |
{ | |
public: | |
virtual const std::string& name() const = 0; | |
}; | |
class EqualNode: public IName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EmptyClass | |
{ | |
virtual ~EmptyClass() = default; | |
}; | |
class DerivedFromEmpty: public EmptyClass | |
{ | |
bool operator==(const DerivedFromEmpty&) const = default; | |
}; |
OlderNewer