codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <iostream> #include <boost/array.hpp> #include <algorithm> namespace NS1 { namespace NS2 { template <typename T1, typename T2> class C { public: typedef typename T1::xType xType; typedef typename T1::yType yType; private: typedef std::pair< xType, yType> EntryType; typedef boost::array< EntryType , 16 > ContainerType; ContainerType mContainer; void FindX(xType) const; public: static bool operator<(const EntryType& lhs, const EntryType& rhs) { return true; } }; template <typename T1, typename T2> void C<T1, T2>::FindX(xType x) const { std::lower_bound( mContainer, mContainer+16, std::make_pair(x, 0.) ); } }} struct S1 { typedef double xType; typedef double yType; }; int main() { NS1::NS2::C<S1, double> c; }
Private
[
?
]
Run code
Submit