예제 #1
0
FieldList operator&(const FieldList & one, const FieldList & two)
{
	if( one.size() == two.size() ) {
		bool same = true;
		foreach( Field * f, one )
			if( !two.contains(f) ) {
				same = false;
				break;
			}
		if( same ) return one;
	}
예제 #2
0
// Optmized to not copy(because of implicit sharing) if one already contains all of two
FieldList operator|(const FieldList & one, const FieldList & two)
{
	bool firstComplete = two.size() <= one.size();
	FieldList ret;
	foreach( Field * f, two )
		if( !one.contains(f) ) {
			if( firstComplete ) {
				firstComplete = false;
				ret = one;
			}
			ret += f;
		}
	return firstComplete ? one : ret;
}