You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Fraction: New ctors accept STL container args
This commit is contained in:
@@ -29,13 +29,23 @@
|
||||
*/
|
||||
|
||||
#include "Fraction.h"
|
||||
#include <cmath>
|
||||
|
||||
using namespace openshot;
|
||||
|
||||
// Constructor
|
||||
Fraction::Fraction() :
|
||||
num(1), den(1) {
|
||||
}
|
||||
// Delegating constructors
|
||||
Fraction::Fraction() : Fraction::Fraction(1, 1) {};
|
||||
|
||||
Fraction::Fraction(std::pair<int, int> pair)
|
||||
: Fraction::Fraction(pair.first, pair.second) {};
|
||||
|
||||
Fraction::Fraction(std::map<std::string, int> mapping)
|
||||
: Fraction::Fraction(mapping["num"], mapping["den"]) {};
|
||||
|
||||
Fraction::Fraction(std::vector<int> vector)
|
||||
: Fraction::Fraction(vector[0], vector[1]) {};
|
||||
|
||||
// Full constructor
|
||||
Fraction::Fraction(int num, int den) :
|
||||
num(num), den(den) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user