C++ "Unknown Knowns"

Hi. So I decided to write a simple little math header for my personal use. You know, useful little things like line intersections, etc.

1
2
3
4
5
6
class line
{
    float; pa[2], pb[2];
    float slope;
    float yipt;
};


But how can I do something where the function user doesn't neccessarily have all of the numerical values at hand? In a way, maybe "setValues(this=this, that=that, rest-left-unentered)"

Thanks!!!
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <iostream>

int add_three( int a, int b, int c ) {
    return a + b + c;
}

int main() {
    boost::function<int(int,int)> add_two( boost::bind( &add_three, 42, _1, _2 ) );
    
    std::cout << add_two( 21, 10 ) << std::endl;
}


Outputs 73.

Not sure if this is what you are looking for.
Last edited on
Topic archived. No new replies allowed.