예제 #1
0
파일: note_sequence.hpp 프로젝트: bnkr/tune
 listed_sqeuence(double concert_pitch, InputIterator begin, InputIterator end, std::size_t reserve = 0) {
   frequencies_.reserve(reserve);
   while (begin != end) {
     if (is_floating_point<typename InputIterator::value_type>(*begin)) {
       double f = boost::lexical_cast<double>(*begin);
       frequencies_.push_back(f);
     }
     else {
       int offset = parse_note(begin->c_str());
       frequencies_.push_back(offset_to_frequency(concert_pitch, offset));
     }
     ++begin;
   }
   iter_ = frequencies_.begin();
 }
예제 #2
0
파일: utils.hpp 프로젝트: raphaelrpl/tws
template<class InputIterator> inline void
tws::core::copy_string_array(InputIterator first,
                             InputIterator last,
                             rapidjson::Value& jvalues,
                             rapidjson::Document::AllocatorType& allocator)
{
  if(!jvalues.IsArray())
    throw tws::conversion_error() << tws::error_description("copy_string_array: can only copy arrays of string data.");
  
  while(first != last)
  {
    jvalues.PushBack(first->c_str(), allocator);
    
    ++first;
  }
}