Declare explicit overloads for ints and doubles.

Implement in terms of existing function template.
This commit is contained in:
Bård Skaflestad 2011-12-02 15:16:35 +01:00
parent fe2db10049
commit 7cf3c62688
2 changed files with 22 additions and 11 deletions

View File

@ -1,4 +1,13 @@
/* Copyright 2010 (c) Jostein R. Natvig <jostein.natvig@gmail.com> */ /*===========================================================================
//
// Author: Jostein R. Natvig <Jostein.R.Natvig@sintef.no>
//
//==========================================================================*/
/*
Copyright 2011 SINTEF ICT, Applied Mathematics.
*/
#include <stdlib.h> #include <stdlib.h>
@ -260,5 +269,12 @@ void read_vector_from_file(const char *fn, std::vector<T>& v)
} }
template void read_vector_from_file<int>(const char *fn, std::vector<int>& v); void read_vector_from_file(const char *fn, std::vector<int>& v)
template void read_vector_from_file<double>(const char *fn, std::vector<double>& v); {
read_vector_from_file<int>(fn, v);
}
void read_vector_from_file(const char *fn, std::vector<double>& v)
{
read_vector_from_file<double>(fn, v);
}

View File

@ -4,11 +4,7 @@
// //
// Created: 2011-11-30 09:35:14+0100 // Created: 2011-11-30 09:35:14+0100
// //
// Authors: Ingeborg S. Ligaarden <Ingeborg.Ligaarden@sintef.no> // Author: Jostein R. Natvig <Jostein.R.Natvig@sintef.no>
// Jostein R. Natvig <Jostein.R.Natvig@sintef.no>
// Halvor M. Nilsen <HalvorMoll.Nilsen@sintef.no>
// Atgeirr F. Rasmussen <atgeirr@sintef.no>
// Bård Skaflestad <Bard.Skaflestad@sintef.no>
// //
//==========================================================================*/ //==========================================================================*/
@ -20,8 +16,7 @@
#ifndef READVECTOR_HPP_HEADER #ifndef READVECTOR_HPP_HEADER
#define READVECTOR_HPP_HEADER #define READVECTOR_HPP_HEADER
void read_vector_from_file(const char *fn, std::vector<int>& v);
template <typename T> void read_vector_from_file(const char *fn, std::vector<double>& v);
void read_vector_from_file(const char *fn, std::vector<T>& v);
#endif /* READVECTOR_HPP_HEADER */ #endif /* READVECTOR_HPP_HEADER */