Sponsored Content
Full Discussion: C++ templates
Top Forums Programming C++ templates Post 302885618 by kristinu on Monday 27th of January 2014 01:31:57 PM
Old 01-27-2014
C++ templates

I have the following template codes but some normal functions too and want
to group them together.

I usually put the implementation of templates in an .ipp file. What would be a good scheme for the normal functions. Put their implementations in a .cpp file, or leave them in the .ipp file?

Code:
#ifndef NUMERIC_HPP
#define NUMERIC_HPP

#include <iostream>
#include <malloc.h>
#include <iomanip>
#include <cstdlib>
#include <string.h>

using namespace std;

template <class T>
inline T  
abs 
(
 T  v
 );

template <class T>
inline T  
sqr 
(
 const T  r
 ) ;

inline bool  
odd 
(
 int  i
 ) {
  
  return (i & 0x1);  //  Bitwise AND, (0101 & 0001) returns true.
  
}

inline bool  
even 
(
 int  i
 ) {
  
  return ( ! (i & 0x1) );  //  Bitwise AND, (0101 & 0001) returns true.
  
}

inline long int  
mem 
(
 );

inline void  
randomize 
(
 );

inline float  
rand 
(
   const float  max
 );

inline int  
rand
(
   const int  max
 );

#include "tomso/numeric/impl/numeric.ipp"

#endif

 

8 More Discussions You Might Find Interesting

1. Programming

c++ templates problems in g++

what we have: class TClass { public: TClass(); }; template<class T> class FClass<T>: public T { public: FClass(); }; TClass::TClass() { // some code } template<class T> FClass<T>::FClass : T() { // some code } int main (int argc,char* argv) { (3 Replies)
Discussion started by: Marhinado John
3 Replies

2. Programming

site templates?

Are there any web site templates on CGI that allow like this forum software user registration and profiles. I dont need forum software i just need to register and keep profiles of my users on my site. Any suggestions? :confused: Thank you all. (1 Reply)
Discussion started by: solvman
1 Replies

3. Post Here to Contact Site Administrators and Moderators

Templates

Hello, Anybody in here has any idea where I can get a template like this one for vBulletin. I have actually got my board but it just doesn't look good in the template that I have! Thanks anyway! him (2 Replies)
Discussion started by: him
2 Replies

4. HP-UX

Where are SAM user templates stored?

Hey, new here, so be nice! I'm trying to write a little script to automate the user creation process on one of our boxes. But I would like to be able to use the templates that we have set up in SAM. Is the information in these templates stored in a file somewhere, that I can reference in my... (5 Replies)
Discussion started by: paqman
5 Replies

5. Shell Programming and Scripting

Reading from Templates

I am trying to write a script that would retrieve specific information from a template. I have been trying to no avail for the longest. This is what I wrote and it's not working. cat filename | while read F5 F6 do if ] then echo $F5 $F6 fi done Here is the template (filename) CN ... (7 Replies)
Discussion started by: Ernst
7 Replies

6. Solaris

A compilation problem when using templates

Hello life savers, I'm having trouble compiling a specific program. The program was originally written for gcc and was compiled successfully under it. When trying to compile under Solaris 11, I get this error: "Hashtable.h", line 170: Error: Could not find a match for hash needed in... (2 Replies)
Discussion started by: yp515
2 Replies

7. Programming

Templates and header file

I have some C++ code and want to have the class declarations in a .h file and the implementation in the .cpp file. It seems however that for templates everything need to be put in the header (.h) file and will have problems if I try to separate the code to a .cpp file. Is this correct? Is... (1 Reply)
Discussion started by: kristinu
1 Replies

8. UNIX and Linux Applications

LibreOffice Templates Custom Distro

Hello, I have a custom Linux distro in which I'm trying to get templates for LibreOffice to ship by default. Is there a location they need to be placed or a file that needs to be edited? I've already tried using the template manager and add templates that way. I then copied /usr/templates/ and... (0 Replies)
Discussion started by: TheOuterLinux
0 Replies
std::extreme_value_distribution< _RealType >(3cxx)						std::extreme_value_distribution< _RealType >(3cxx)

NAME
std::extreme_value_distribution< _RealType > - SYNOPSIS
Classes struct param_type Public Types typedef _RealType result_type Public Member Functions extreme_value_distribution (_RealType __a=_RealType(0), _RealType __b=_RealType(1)) extreme_value_distribution (const param_type &__p) _RealType a () const _RealType b () const result_type max () const result_type min () const template<typename _UniformRandomNumberGenerator > result_type operator() (_UniformRandomNumberGenerator &__urng) template<typename _UniformRandomNumberGenerator > result_type operator() (_UniformRandomNumberGenerator &__urng, const param_type &__p) param_type param () const void param (const param_type &__param) void reset () Detailed Description template<typename _RealType = double>class std::extreme_value_distribution< _RealType > A extreme_value_distribution random number distribution. The formula for the normal probability mass function is p(x|a,b) = ac{1}{b} xp( ac{a-x}{b} - xp(ac{a-x}{b})) ] Definition at line 4494 of file random.h. Member Typedef Documentation template<typename _RealType = double> typedef _RealType std::extreme_value_distribution< _RealType >::result_type The type of the range of the distribution. Definition at line 4501 of file random.h. Member Function Documentation template<typename _RealType = double> _RealType std::extreme_value_distribution< _RealType >::a () const [inline] Return the $a$ parameter of the distribution. Definition at line 4552 of file random.h. template<typename _RealType = double> _RealType std::extreme_value_distribution< _RealType >::b () const [inline] Return the $b$ parameter of the distribution. Definition at line 4559 of file random.h. template<typename _RealType = double> result_type std::extreme_value_distribution< _RealType >::max () const [inline] Returns the least upper bound value of the distribution. Definition at line 4588 of file random.h. template<typename _RealType = double> result_type std::extreme_value_distribution< _RealType >::min () const [inline] Returns the greatest lower bound value of the distribution. Definition at line 4581 of file random.h. template<typename _RealType = double> template<typename _UniformRandomNumberGenerator > result_type std::extreme_value_distribution< _RealType >::operator() (_UniformRandomNumberGenerator &__urng) [inline] Generating functions. Definition at line 4596 of file random.h. References std::extreme_value_distribution< _RealType >::operator()(), and std::extreme_value_distribution< _RealType >::param(). Referenced by std::extreme_value_distribution< _RealType >::operator()(). template<typename _RealType = double> param_type std::extreme_value_distribution< _RealType >::param () const [inline] Returns the parameter set of the distribution. Definition at line 4566 of file random.h. Referenced by std::extreme_value_distribution< _RealType >::operator()(), std::operator==(), and std::operator>>(). template<typename _RealType = double> void std::extreme_value_distribution< _RealType >::param (const param_type &__param) [inline] Sets the parameter set of the distribution. Parameters: __param The new parameter set of the distribution. Definition at line 4574 of file random.h. template<typename _RealType = double> void std::extreme_value_distribution< _RealType >::reset () [inline] Resets the distribution state. Definition at line 4545 of file random.h. Author Generated automatically by Doxygen for libstdc++ from the source code. libstdc++ Tue Nov 27 2012 std::extreme_value_distribution< _RealType >(3cxx)
All times are GMT -4. The time now is 08:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy