1 // Code for the -*- C++ -*- namespace Sequence::PolyTable template members
5 Copyright (C) 2003-2009 Kevin Thornton, krthornt[]@[]uci.edu
7 Remove the brackets to email me.
9 This file is part of libsequence.
11 libsequence is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 libsequence is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 long with libsequence. If not, see <http://www.gnu.org/licenses/>.
27 #ifndef __POLY_TABLE_TCC__
28 #define __POLY_TABLE_TCC__
34 template<typename numeric_type,
36 bool PolyTable::assign( const numeric_type * _positions,
37 const size_t & _num_positions,
38 const string_type * _data,
39 const size_t & _num_individuals )
41 //The numeric array must be convertible to double
42 static_assert( std::is_convertible<numeric_type,double>::value,
43 "numeric_type must be convertible to double");
44 //The character type must be eithe char * or std::string
45 static_assert( (std::is_same<string_type,char*>::value ||
46 std::is_same<string_type,std::string>::value),
47 "string_type must be char * or std::string");
49 first.resize(_num_positions);
50 second.resize(_num_individuals);
51 first.assign(_positions,_positions+_num_positions);
52 second.assign(_data,_data+_num_individuals);
53 non_const_access = true;
54 for(std::vector<std::string>::const_iterator itr = second.begin() ;
55 itr < second.end() ; ++itr)
57 if (itr->length() != _num_positions)