Page MenuHomec4science

vec2ext.h
No OneTemporary

File Metadata

Created
Tue, Oct 15, 10:59

vec2ext.h

#pragma once
#ifndef __VEC2EXT_H__
#define __VEC2EXT_H__
#define _USE_VECTOR_OSTREAM
#include "symbasic/svector.h"
#include <istream>
// two dimensional vector definition
typedef SVector<double, 2> Vec2D;
/*
* Allows to load any kind of bi-dimensional vectors
* using the form (x, y)
*
* Example: (2, 3)
*
* for SVector declaration, take a look to "symbasic/svector.h"
*/
template<class T>
std::istream& operator>>(std::istream& is, SVector<T, 2>& v)
{
/*char delim;
is >> std::skipws;
is >> delim;
if (delim != '(')
throw '(';
is >> v[0];
is >> delim;
if (delim != ',')
throw ',';
is >> v[1];
is >> delim;
if (delim != ')')
throw ')';*/
return regex::parse(is, regex::term::round, v[0], v[1]);
}
#endif

Event Timeline