yet another site c++ enum class — scoped and strongly typed enums Python argument expansion Epislon Pointer to Implementation idiom Template dependent name python list slicing Energy function/loss function energy function objective function cost function loss function likelihood function c++ type sepcifier, modifier, qualifier type modifier access modifier qualifier type specifier c++ term

stackoverflow:c++ template template

#include <iostream>
#include <vector>
#include <list>
#include <iterator>
#include <algorithm>

template <template<class, class...> class H, class T>
void f(const H<T> &value) {
    std::copy(value.begin(), value.end(), std::ostream_iterator<T>(std::cout, " "));
    std::cout << "generic implementationn";
    std::cout << __PRETTY_FUNCTION__ << std::endl;
}

//https ...

more ...


c++ enum class -- scoped and strongly typed enums

Date

Sun 18 August 2019

By
Nekoo
Category
c++.
Tags
c++

enum class

  • enumerator names are local to the enum
  • their values do not implicitly convert to other types
  • the underlying type of an enum can be specified.

plain enum

  • enumerator names are in the same scope as the enum, causing name clashes.
  • their values implicitly convert to intergers and other ...

more ...


Python argument expansion

  • * operator: positional argument expansion
    for a list, expand to function call argument list

  • ** operator: keyword argument expansion for a dictionary, expand to function call keyword argument list

def add(a, b):
  print a+b

a = [1, 2]
kwargs={'b':1, 'a': 1}
add(*a)
add(**kwargs)


def add(a, *args ...

more ...


Epislon

machine epsilon

https://en.wikipedia.org/wiki/Machine_epsilon

epsilon-delta defintion of limit

https://en.wikipedia.org/wiki/(%CE%B5,_%CE%B4)-definition_of_limit

more ...


Pointer to Implementation idiom

Date

Sun 11 August 2019

By
Nekoo
Category
c++.
Tags
c++

Keywords

  • Reduce compilation dependency
  • pointer to implementation, smart pointer
  • forward declaration
  • incomplete type
  • constness forwarding

Reference:

fluent c++
The Pimpl Pattern - what you should know
GotW

more ...


Template dependent name

Date

Tue 06 August 2019

By
Nekoo
Category
c++.
Tags
c++

https://en.cppreference.com/w/cpp/language/dependent_name

https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords

more ...


python list slicing

一个很好的总结:
stackoverflow: Understanding slice notation

a[start:end:step] # items from start through  stop - 1. a[stop] not included.

当step为负数的时候,算法跟之前一样,[start, start+step, start+step+step, ..., end)

more ...


Energy function/loss function

energy function

https://en.wikipedia.org/wiki/Energy_functional
https://stackoverflow.com/questions/50342526/what-is-the-difference-between-energy-function-and-loss-function

objective function

cost function

loss function

https://en.wikipedia.org/wiki/Loss_function

likelihood function

In statistics, the likelihood function (often simply called likelihood) expresses how likely particular values of statistical parameters are for a given set ...

more ...


c++ type sepcifier, modifier, qualifier

Date

Sat 03 August 2019

By
Nekoo
Category
c++.
Tags
c++

type modifier

A modifier is used to alter the meaning of the base type so that it more
precisely fits the needs of various situations.
* size
* sign

access modifier

  • private
  • public
  • protected

qualifier

The type qualifiers provide additional information about the variables they precede.
* const
* volatile
* restrict

type specifier

  • friend ...

more ...


c++ term

Date

Sun 28 July 2019

By
Nekoo
Category
c++.
Tags
c++

closure
free varialbe
first order function

callable object
* function object, functor
A function object (or functor) is simply any object of a class that provides at least one definition for operator() What this means is that if you then declare an object f of the class in which this operator ...

more ...